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!

How to add not null column to an existing table?

user12081439Jul 3 2010 — edited Sep 29 2010
I have a table with hundreds of row in it. I am trying to add a new column with not null. It is giving me the following error

ALTER TABLE sys.xyz MODIFY xyz_no NUMBER(4) DEFAULT '1' NOT NULL;

ORA-02296: cannot enable (sys.) - null values found

Also i tried to do the following

ALTER TABLE sys.xyz MODIFY xyz_no NUMBER(4) DEFAULT '1';

And then i tried to ALTER TABLE sys.xyz MODIFY xyz_NO NUMBER(4) NOT NULL; and still i gave me the same error. I took the count for the null values for the same column and found it has 1555.

In this scenario how do i modify my column with not null ?. Please help i am a newbie to oracle.
This post has been answered by damorgan on Jul 3 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 27 2010
Added on Jul 3 2010
9 comments
41,884 views