Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: NULL v. null string

Re: NULL v. null string

From: Karen Abgarian <abvk_at_apple.com>
Date: Mon, 16 Jul 2001 13:54:44 -0700
Message-ID: <3B5354BF.3E1E962C@apple.com>

Your speculation is very logical, but the result of '' = '' will be false.

From Oracle's point, '' is null.

Whether this is good or not, this is another matter.

Regs
Karen Abgarian

Gerrit-Jan Linker wrote:

> I always remember this behavior by thinking what null actually means. NULL
> is an indication that no value is specified. A null string '' specifies an
> empty string, which is a definite value.
>
> Now when comparing values you cannot say anything sensible when one of the
> values is NULL (unspecified). It would be great if boolean logic would have
> Yes/No/Don't Know as values. Or perhaps that would just be even more
> confusing. Anyhow these comparisons will render:
>
> Null = '' is False (meaning Don't Know)
> Null = Null is False (meaning Don't Know; comparing 2 unknowns, how can
> they ever be equal?)
> '' = Null is False (meaning Don't Know)
> '' = '' True (you specified 2 values, and yes both of the values are
> empty strings)
>
> Hope this did not confuse you even more...
>
> --
> Gerrit-Jan Linker
> SQL*XL: addin for Excel for easy access to Oracle databases
> http://www.oraxcel.com
>
> "Chuck Hamilton" <chuck_hamilton_at_yahoo.com> wrote in message
> news:1hvtkt0ggngfnendsgejsodpko3d2e04l5_at_4ax.com...
> > If NULL is not the same as a null string, then why does this block of
> > code display 'YES'.
> >
> > begin
> > if '' is null then
> > dbms_output.put_line('yes');
> > else
> > dbms_output.put_Line('no');
> > end if;
> > end;
> >
> > Same this with this. If null string is a known value and NULL is an
> > unknown value, why does this display no?
> >
> > begin
> > if '' = '' then
> > dbms_output.put_line('yes');
> > else
> > dbms_output.put_Line('no');
> > end if;
> > end;
 

> > --
> > Chuck Hamilton
> > chuck_hamilton_at_yahoo.com
> >
> > "Do not be deceived, God is not mocked;
> > for whatever a man sows, this he will also
> > reap." (Gal 6:7 NASB)
Received on Mon Jul 16 2001 - 15:54:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US