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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Null value is string

Re: Null value is string

From: Suzy Vordos <lvordos_at_qwest.com>
Date: Tue, 09 Jul 2002 16:03:20 -0800
Message-ID: <F001.0049318A.20020709160320@fatcity.com>

This example will insert a string value of 'null', which likely isn't what you want, nor a good idea. Remove the quotes from null, and the column default will instead be a null. Example:

SQL> create table student (student_name varchar2(10) default null);

A null string and a null value are not the same thing, which you can see using dump:

SQL> select dump(student_name) from student;

DUMP(STUDENT_NAME)



Typ=1 Len=4: 110,117,108,108 <-- null string NULL <-- null value

I once worked with a developer who didn't understand the difference, and inserted null strings instead. It was a mess.

Suzy

"donald.holloway" wrote:
>
> All,
>
> I need to know if there is a way to insert a character value of 'null' as a
> default for a column:
>
> example: student_name varchar2(10) default 'null'
>
> I have tried this and it works if I update the column values to the string
> 'null' later:
>
> example: update student set student_name = 'null' where student_name is
> null
>
> I know that null is a reserved word but I though that I saw it used
> somewhere like this before and just thought I would check with the group on
> this. thanks.
>
> Joseph Hway
> hway_at_uswest.net
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: donald.holloway
> INET: Donald.Holloway_at_wcom.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Suzy Vordos
  INET: lvordos_at_qwest.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Jul 09 2002 - 19:03:20 CDT

Original text of this message

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