Re: Variables in SP do not compare as equal when both are NULL "mike" <_link98@yahoo.com> wrote in message
news:1152514099.822155.301690@75g2000cwc.googlegro ups.com...
>
> It is because in SQL, NULL is not a value, but the absence of one.
> The equality predicate compares two values, not absence of them,
> and if either of the operands to the equality predicate are NULL
> then the result is unknown.
>
That sounds like a circular argument to me (as does the other one posted by
Jeroene).
You claim that null is not a value, but the phrase "null value" turns up
frequently, including in DB2 documentation. And there are exceptions, such
as when using the DISTINCT predicate, where "null values are considered
equal. So (COL1 is NOT DISTINCT from COL2) will be true if both columns
contain an equal non-null value and also when both columns are the null
value." [quote from iSeries DB2 Infocenter].
Obviously, someone thought that relational theory dictated that two nulls
are not equal, but I don't quite understand under what conditions that it
would be useful. It just seems we have to do a lot of extra coding to get
around this "rule". |