| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Length of empty string?
There really isn't an 'empty string' in Oracle. You are testing the length
of NULL. Just about any operation on NULL returns NULL.
Personally, I disagree with this behavior. Coming from a more traditional programming background, I think of '' as the empty string. But in SQL/PLSQL class, the instructor went out of his way to point this distinction out.
Bill Bearden
Bill Bearden Consulting
Roy Smith <roy_at_popmail.med.nyu.edu> wrote in article
<roy-0105980957060001_at_qwerky.med.nyu.edu>...
> Why does length() return nothing (instead of the number zero) on an
> zero-length string?
>
>
> SQL> select length('xxx') from dual;
>
> LENGTH('XXX')
> -------------
> 3
>
> SQL> select length('') from dual;
>
> LENGTH('')
> ----------
>
>
> SQL>
>
> The first query makes sense, but the second one does not. I would have
> expected to get back zero. Instead I'm getting back nothing, or blank,
or
> something which isn't zero. I'm confused.
>
> --
> Roy Smith <roy_at_popmail.med.nyu.edu>
> New York University School of Medicine
>
>
Received on Sat May 02 1998 - 07:29:51 CDT
![]() |
![]() |