0

I have a question regarding handling NULL value in a column in ORACLE Table.

So, when i query a table, i get this error message in every NULL value occurences

Notice: Undefined index: STATUS in C:\xampp\htdocs\WeltesInformationCenter\AdminLTE\pages\tables\assignmenttable.php on line 481

my query is like this

SELECT MASTER_DRAWING.*, (SELECT PREPACKING_LIST.PACKING_STATUS FROM PREPACKING_LIST WHERE MASTER_DRAWING.HEAD_MARK = PREPACKING_LIST.HEAD_MARK) STATUS FROM MASTER_DRAWING WHERE PROJECT_NAME = :PROJNAME

My question is, how to handle NULL value so that when it sees a null value, it can return some value such as 0 or any string.

Thanks

4
  • 1
    You can use NVL to replace null with another value, but more likely, you have a problem in your PHP code. Commented Sep 10, 2014 at 8:30
  • @ammoQ i did try this SELECT MASTER_DRAWING.*, (SELECT NVL(PREPACKING_LIST.PACKING_STATUS,'N/A') FROM PREPACKING_LIST WHERE MASTER_DRAWING.HEAD_MARK = PREPACKING_LIST.HEAD_MARK) STATUS FROM MASTER_DRAWING WHERE PROJECT_NAME = :PROJNAME But its doesnt work Commented Sep 10, 2014 at 8:40
  • 2
    try SELECT MASTER_DRAWING.*, NVL((SELECT PREPACKING_LIST.PACKING_STATUS FROM PREPACKING_LIST WHERE MASTER_DRAWING.HEAD_MARK = PREPACKING_LIST.HEAD_MARK),'N/A') STATUS FROM MASTER_DRAWING WHERE PROJECT_NAME = :PROJNAME instead Commented Sep 10, 2014 at 8:43
  • Awesome, post it in an answer so i can rate this a a correct answer Commented Sep 10, 2014 at 8:52

1 Answer 1

2

Try

SELECT MASTER_DRAWING.*,
   NVL((SELECT PREPACKING_LIST.PACKING_STATUS
      FROM PREPACKING_LIST
      WHERE MASTER_DRAWING.HEAD_MARK = PREPACKING_LIST.HEAD_MARK),'N/A'
   ) STATUS
 FROM MASTER_DRAWING WHERE PROJECT_NAME = :PROJNAME
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.