Skip to Main Content

Oracle Database Discussions

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!

alter table add constraint vs alter table modify

Chri$ASep 1 2014 — edited Sep 1 2014

Hello,

anyone could explain why we have two different statements when adding a constraint on an existing table ?

If I need to add a primary key constraint to a column belonging to an existing table I use:

alter table tab1 add constraint tab1_id_cst primary key( id )

but if I want to add a NOT NULL constraint, the same syntax does not work, I need to use alter table modify instead

Why ?

Thank you !

This post has been answered by BM_exa-Oracle on Sep 1 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2014
Added on Sep 1 2014
8 comments
2,482 views