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: Empty strings

Re: Empty strings

From: <mpir_at_compuserve.com>
Date: Fri, 18 Dec 1998 19:30:50 GMT
Message-ID: <75eaha$dtk$1@nnrp1.dejanews.com>


What do you mean by an empty string?

If you mean a string of length 0, that is a null string.

If you mean a string of spaces, that can be stored, but it is a little tricky. You either need a direct assignment (empty_string := chr(32)) or the pad functions (lpad and rpad) might work.

If you are using varchar2 in a PRO* language such as C, you might even be able to store chr(0)(s) if you set the length component (such as  empty_string.arr[0]=0;
 empty_string.len=1;

In article <367988A4.6E1008FB_at_digital-dispatch.com>,   DDS101 <dds101_at_digital-dispatch.com> wrote:
> We've recently started using Oracle and much to my surprise (and
> dismay!) I've just discovered that we don't seem to be able to store an
> empty string in a CHAR or a VARCHAR2 column. Any attempt to do so
> results in the empty string being converted into a NULL.
>
> (To me a NULL is different from an empty string just as a NULL is
> different from the number 0. Being told I can't store an empty string
> in a VARCHAR2 column is as surprising as being told I can't store the
> number 0 in a NUMBER column.)
>
> So, my questions are: Is the above true? And, if so, is there a
> "standard" way that users of Oracle deal with this issue? Our local DB
> guy doesn't want to store NULLs in the offending column. Do we have to
> store a "magic" (non-empty) string instead?
>
> Any help or pointers to related links would be much appreciated.
>
> Thanks.
>
> Mark
>
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Dec 18 1998 - 13:30:50 CST

Original text of this message

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