Oracle PL/SQL/Data Type/NULL

Материал из SQL эксперт
Версия от 12:58, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

2 meaningless values can"t be compared against one another

   <source lang="sql">

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

</source>
   
  


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

   <source lang="sql">

SQL> select 12 from dual where null is null;

       12

       12

1 row selected. SQL> SQL>

</source>
   
  


using the nvl function

   <source lang="sql">

SQL> select 12 from dual where nvl(null,"X") = nvl(null,"X");

       12

       12

1 row selected. SQL> SQL> SQL>

</source>