Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Empty String is interpreted as NULL
Thanks for all replies.
Right now I think I can afford just make the column NULL, so that's what I'll do. But still, something doesn't feel quite right with empty string == NULL :).
RDB
On Friday 18 July 2003 03:22 pm, Mercadante, Thomas F wrote:
> Reuben,
>
> While I agree that an empty string is not logically equal to a null, Oracle
> interprets an empty string in INSERT and UPDATE statements as a NULL. So
> you really do not have a choice here. If you have the need to insert an
> empty string into a column, you have two choices:
>
> - Define a character to represent an empty string and insert that character
> (pretty dumb suggestion)
>
> - Change the table to allow null values in that column, and perform the
> INSERT as your example showed.
>
> Good Luck and hope these helped.
>
> Tom Mercadante
> Oracle Certified Professional
>
>
> -----Original Message-----
> From: Reuben D. Budiardja [mailto:techlist_at_voyager.phys.utk.edu]
> Sent: Friday, July 18, 2003 4:10 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Empty String is interpreted as NULL
>
>
> Hello all,
> Suppose I have this table
>
> SQL> DESC FRUIT
> Name Null? Type
> ----------------------------------------- --------
> ORANGE NOT NULL VARCHAR2(10)
> APPLE NOT NULL VARCHAR2(10)
>
> If I do this insert:
>
> SQL> /
> INSERT INTO FRUIT VALUES ('hello', '')
> *
> ERROR at line 1:
> ORA-01400: cannot insert NULL into ("LIGHTCONE"."FRUIT"."APPLE")
>
> I got an error cannot insert NULL. But, what if I meant is to insert empty
> string '' ? Certainly empty string is NOT equal to NULL values.
>
> So how do I get around this?
>
> Thanks in advance for any help.
>
>
> Reuben D. Budiardja
-- Reuben D. Budiardja Department of Physics and Astronomy The University of Tennessee, Knoxville, TN ------------------------------------------------- /"\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ ------------------------------------------------- Have you been used by Microsoft today? Choose your life. Choose freedom.Received on Sat Jul 19 2003 - 09:58:00 CDT
![]() |
![]() |