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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Constraints, adding and modifying

ee5e93c1-ae4c-44c3-bf72-0dc55b87ea8fApr 10 2016 — edited Apr 10 2016

When adding constraints to columns, is there any real difference between using syntax such as:

ALTER TABLE table

ADD CONSTRAINT constraintname TYPE(columnname);

versus

ALTER TABLE table

MODIFY (columnname CONSTRAINT constraintname TYPE);

They seem to do the same things. Both require the same information. I suppose to try and answer this myself, the only real difference is that adding should be used when a constraint doesn't already exist, and modify should be used when you're changing a constraint that already exists? However, when doing my hands-on assignment for my class, it said to make the names columns NOT NULL, it accepted my use of MODIFY. I checked my list of constraints and they were added. So does it really matter?

This post has been answered by mathguy on Apr 10 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 8 2016
Added on Apr 10 2016
5 comments
1,969 views