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

Home -> Community -> Usenet -> c.d.o.misc -> Re: VARCHAR2: NULL value vs. empty string

Re: VARCHAR2: NULL value vs. empty string

From: Frank <fbortel_at_nescape.net>
Date: Tue, 16 Dec 2003 22:27:23 +0100
Message-ID: <brnsqv$r7$1@news1.tilbu1.nb.home.nl>


NoName wrote:

>>If NULL is not a zero length string, then why does Oracle do this? :-
>>SQL> select 'abc'||null from dual;
>>
>>'AB
>>---
>>abc
>>
>>It should return NULL, should it not?

>
>
> I can assure you that empty string <> NULL value.
> According to Oracle 8.0 SQL Reference Manual, Chapter 3, paragraph about
> "Concatenation Operator":
> --- start ---
> Although Oracle treats zero-length character strings as nulls, concatenating
> a zero-length character string with another operand
> always results in the other operand, so null can result only from the
> concatenation of two null strings. However, this may not
> continue to be true in future versions of Oracle. To concatenate an
> expression that might be null, use the NVL function to
> explicitly convert the expression to a zero-length string.
> --- end ---
>
> Regards
>
>

And that's another non-ANSI compliant behaviour... Look it up: concatenation of a string with NULL yields NULL, concatenation of a string with an other, empty string yields the first string

-- 
Regards, Frank van Bortel
Received on Tue Dec 16 2003 - 15:27:23 CST

Original text of this message

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