--Oracle treats the empty string as null, and the test script is as follows:
select nvl(null,-1) from dual;sele‘‘,‘-1‘) from dual;select nvl(nvl(null,‘‘),-1) from dual;select nvl(trim(‘ ‘),‘-1‘) from dual;ct nvl(
--but remember, null and any value do a logical operation with the result of false, including and null itself:
Select NVL (Max' 1 '),-1)From dualwhereNULL =‘‘;Select NVL (Max' 1 '),-1)From dualwhereNull <>‘‘;Select NVL (Max' 1 '),-1)From dualwhereNULL ='-1 ';Select NVL (Max ' 1 '),-1) from dual where null <> '-1 '; select nvl (max ( ' 1 '),-1) from dual where null = null; select nvl (max ( ' 1 '),-1) from dual where null <> null;
--however, when judged with IS null, the empty string and null are null:
select nvl(max(‘1‘),-1) from dual where ‘‘ is null;select nvl(max(‘1‘),-1) from dual where null is null;
--also remember that null and any numeric values are mathematically calculated, and the result is null:
select nvl(null + 0,-1) from dual;
--However, you can use | | Concatenate an empty string or null and string
select ‘a‘ || null || ‘b‘ from dual;
--Also, the result is null as an argument to the following Oracle built-in function:
Select NVL (Length (NULL),-1)from dual;Select NVL (Trim (NULL),-1)from dual;Select NVL (LTrim (NULL),'-1 ')from dual;Select NVL (RTrim (NULL),'-1 ')from dual;Select NVL (RTrim (Null‘ ‘),'-1 ')from dual;Select NVL (Soundex (NULL),'-1 ')from dual;Select NVL (SUBSTR (Null1),-1)from dual;Select NVL (INSTR (Null1),-1)from dual;Select NVL (ReplaceNull' A ',' B '),'-1 ')from dual;Select NVL (MinNULL),'-1 ')from dual;select nvl (max (null), '-1 ') from dual; select nvl (sum (null), '-1 ') from dual; select nvl (avg (null), '-1 ') from dual; select nvl (sum (null), '-1 ') from dual;
--however, the result is not NULL as an argument to the following Oracle built-in function:
select concat(‘a‘, null) from dual;select concat(null, ‘a‘) from dual;select count(null) from dual;
--when other functions are used, you can also use the methods above to test
Source: http://edgenhuang.iteye.com/blog/975567