Re: IS (NULL = 1) equal to NOT(NULL = 1)?

From: David J Roth <droth_at_adaptron.com>
Date: 1996/08/22
Message-ID: <321C6EA5.C56_at_adaptron.com>#1/1


Guy Bassan wrote:
>
> According to Oracle's documentation (which is occasionally correct),
> whenever you use NULL in any kind of function, you almost always get
> NULL back. (NULL = 1) is a function that returns a boolean: TRUE,
> FALSE or NULL. Usually booleans only have two values, but Oracle isn't
> constrained by silly conventions like that.

This is the correct performance. SQL uses 3 value logic (True, False, Unknown). Codd the father of the relational database concept and Date the 1st RDBMS evalgelist have had a running debate for years about whether or not this is appropriate but that is the way it is.

Any RDBMS that does comply with the true, false notion is more than silly, it is wrong and will return incorrect results if any fields can be null.

>
> Now, since (NULL = 1) is sort of like a function using NULL, the boolean
> value returned is NULL. Similarly, when you take not(NULL), you are
> again using a function on NULL, and NULL is again returned. Thus, both
> times you are doing IF (NULL), and since NULL is not TRUE, the program
> runs the ELSE condition both times.
>
> To summarize: Yes, (NULL = 1) is equal to NOT(NULL = 1)
>
> -- Guy Bassan
> -- Los Alamos National Laboratories
  Received on Thu Aug 22 1996 - 00:00:00 CEST

Original text of this message