Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: About default value in create table
"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
![]() |
![]() |