Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Set a column to be nullable

570831Apr 4 2007 — edited Apr 4 2007
Hi, I am not really good at SQL. Please help me if you can.

I have a column that's Nullable (yes), default (1). Now I want to set the default of the column to null and set the column to be nullable. Here is what I am doing:

create table testit
(foo number default 1 not null, doo varchar(10));

insert into testit (foo, doo) values (15, 'a')
insert into testit (foo, doo) values (14, 'b')
insert into testit (doo) values ('c')

select * from testit

This will return 3 rows where foo=1 when doo='c'. Now I do:

ALTER TABLE testit
modify foo DEFAULT NULL

This will set the default value of foo to be NULL, however, the Nullable is still No. Then when I do

insert into testit (doo) values ('ddd')

I get "cannot insert Null into (testit.foo). What should I do?

Thanks. :D
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2007
Added on Apr 4 2007
5 comments
1,766 views