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: About default value in create table

Re: About default value in create table

From: André Hartmann <andrehartmann_at_hotmail.com>
Date: Wed, 7 Jul 2004 17:42:20 +0200
Message-ID: <40ec19df@olaf.komtel.net>

"Michael" <michaelwah_at_tom.com.hk> schrieb im Newsbeitrag news:57aa0935.0407070729.36b93e7e_at_posting.google.com...
> I am a new user of Oracle. I got a problem about create table.
> I create a table
>
> create table TEST (
> COL1 nchar(10) default '' not null,
> COL2 nchar(10) default '' not null
> ); /* this line is OK */
>
> insert into TEST( COL1 ) values ( 'A' )
> /* this line fail, becuase cannot assign NULL to COL2 */
>
> What is wrong.... ???

'' is the same as NULL. Oracle treats NULL and empty string as identical values. So saying NOT NULL and assigning '' as the default value is a contradiction because you are assigning NULL ( = '') to a column that you dont want to have NULL values. Received on Wed Jul 07 2004 - 10:42:20 CDT

Original text of this message

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