Re: Warning about null and open question to Oracle

From: Keith Leng <keith_at_keithl.demon.co.uk>
Date: 1995/06/15
Message-ID: <3rpil5$2ga_at_imp.demon.co.uk>#1/1


stevec_at_zimmer.CSUFresno.EDU (Steve Cosner) wrote:

>>IF nvl(a,0) = nvl(b,0) then
>> do something;
>>END IF;
 
>Watch out! The above example will fail when a=0 and b is null, and
>when a is null and b=0.

Could you expand on that a little? I cannot see why it would fail. It seems to me to be equivalent to the following which works as you would expect.

SQL> create table temp (a char(1) null, b char(1) null);

Table created.

SQL> insert into temp values (null,0);

1 row created.

SQL> select * from temp
  2 where nvl(a,0) = nvl(b,0);

A B
- -

     0

Keith Leng (keith_at_keithl.demon.co.uk) Received on Thu Jun 15 1995 - 00:00:00 CEST

Original text of this message