Oracle PL/SQL/Data Type/NULL

Материал из SQL эксперт
Перейти к: навигация, поиск

2 meaningless values can"t be compared against one another

 
SQL> select 12 from dual where null = null;
no rows selected
SQL>
SQL>



This in the only way to do it properly to get the desired results

 
SQL> select 12 from dual where null is null;
        12
----------
        12
1 row selected.
SQL>
SQL>



using the nvl function

 
SQL> select 12 from dual where nvl(null,"X") = nvl(null,"X");
        12
----------
        12
1 row selected.
SQL>
SQL>
SQL>