Set a column to be nullable
570831Apr 4 2007 — edited Apr 4 2007Hi, 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