我有一个关于在ORACLE表中的列中处理NULL值的问题。
因此,当我查询表时,我会在每个NULL值出现
时收到此错误消息Notice: Undefined index: STATUS in C:\xampp\htdocs\WeltesInformationCenter\AdminLTE\pages\tables\assignmenttable.php on line 481
我的查询就像这样
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
我的问题是,如何处理NULL值,以便当它看到空值时,它可以返回一些值,如0或任何字符串。
由于
答案 0 :(得分:2)
尝试
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