Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: NULL v. null string
Chuck Hamilton <chuck_hamilton_at_yahoo.com> writes:
That's true that for the moment '' is being treated as NULL, but as Oracle's documentation indicates, this could change in the future releases, so it's better to use NULL when you think of an unknown value and to use '' when you are dealing with an empty string (conceptually these are two different things). Remember that Oracle uses three-value logic of TRUE, FALSE and UNKNOWN when using nulls.
Mikolaj Morzy
> 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 Fri Jul 20 2001 - 05:58:58 CDT