Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Funny comparisions :)
A copy of this was sent to "Michael Ju. Tokarev" <mjt_at_tls.msk.ru>
(if that email address didn't require changing)
On Wed, 29 Dec 1999 18:28:28 +0300, you wrote:
>Thomas Kyte wrote:
>>
>[]
>> >
>>
>> how about
>>
>> if ( a = b OR (a is null and b is null) )
>> then
>> -- they are "equal"
>> else
>> -- they are not
>> end if;
>>
>
>This is a bit strange for me. Maybe some was changed in recent (or not very so)
>versions? I always thinked that
> a = b is null if a or b is null
sort of correct. "a=b" is UNKNOWN if a and/or b is NULL.
> a or b is also null if a or b is null
it is not NULL, it is unknown (tri-valued logic, values of TRUE, FALSE, UNKNOWN). In the above, if a AND b is NULL, this evaluates to
if ( UNKNOWN or ( TRUE and TRUE ) ) then
and that evaluates to
if ( TRUE ) then
In the above, if A is NULL and B is NOT NULL, this evaluates to
if ( UNKNOWN or ( TRUE and FALSE ) ) then
and that evaluates simply to
if ( FALSE ) then...
>Maybe I was totally wrong... The secons one seemed to be ok (logic!) --
>if b is true, the whole expression should be true whenever a is true/false/null.
>But if b is false, the whole one will be the same as a -- true/false/NULL (i.e.
>if b is false, and a is null, than (a or b) is also null). Right?
>
>If so, then I just "invented a bicycle", sorry for my stupid "solution" for non-existed
>problem... And yes, that is worked (surprise ;)!
>
no problem -- there are typically dozens of ways to solve every problem....
>[]
>>
>> Thomas Kyte tkyte_at_us.oracle.com
>> Oracle Service Industries Reston, VA USA
>>
>
>Thanks!
--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed Dec 29 1999 - 10:16:28 CST