As a clarification, in the Oracle World, NULL is "an
unknown value". Additionally, the "
=" operator
compares the bits of the expression to the left of the "=" to the bits of the expression to the right of the "=". If there are no bits to compare to, then Oracle says that the result of the comparison is also NULL/unknown.
However, you can successfully ask if the contents of an expression are, themselves, unknown (i.e., NULL). To do this, you compare an expression to NULL with the "
is NULL" comparison:
Code:
SQL> Select 'TRUE' from dual where null = null;
no rows selected
SQL> c/=/is
1* Select 'TRUE' from dual where null is null
SQL> /
'TRU
----
TRUE
Notice in the above query, when we used the "=" to compare NULL to NULL, the answer was "not TRUE", but the answer was also "not FALSE"; the answer was "unknown" (i.e., NULL). That is why there were "no rows selected."
If, however, we ask if "an unknown value
is an unknown value" (i.e., "...WHERE NULL is NULL") then the result is TRUE.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services:
www.dasages.com]