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: Length of empty string?

Re: Length of empty string?

From: LECONTE Denis <leconte.d_at_decade.fr>
Date: Fri, 1 May 1998 17:42:05 +0200
Message-ID: <6icqk9$2cv$1@peggy.freenet.fr>


Because a zero-length string is equal to NULL under Oracle. Many functions return NULL when their parameter is NULL and a "normal" (numeric, string or date) value in other cases.

length (NULL) = length ('') ==> NULL

If you desesperately want a numeric result you can use the built-in function NVL (Expr, ReturnValueIfNull). It return Expr if Expr is not NULL or the other parameter in the other case: select NVL (length (YourString), 0) from dual;

This way you will get back the good length of the string.

Regards.

Denis.

Roy Smith a écrit dans le message ...
|Why does length() return nothing (instead of the number zero) on an
|zero-length string?
Received on Fri May 01 1998 - 10:42:05 CDT

Original text of this message

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