This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes Check Constraints Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Check Constraints" Watch "Check Constraints" New topic

Check Constraints

Han You

Joined: Oct 26, 2003
Posts: 25
Is there any way to modify an existing CHECK constraint on a table without doing a drop and add? I am interested in this for both 9i and 10g. Thanks to anyone that has an answer in advance.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43892
Don't know. I Googled and found this, whihc suggests you can't alter a constraint.
Agador Paloi
Ranch Hand

Joined: Jan 24, 2006
Posts: 118
can alter table to add constraint, for example:

ALTER TABLE table_name
ADD (CONSTRAINT constr_name CHECK ( yes_no_col_name IN ('N', 'Y')))
Hemavathy Ramamoorthy Gopal

Joined: May 13, 2008
Posts: 17

In oracle modifying exsiting constraints without dropping it is not possible. Always this two steps need to be followed Step 1 : Drop the constraints if exist. Step 2 : Add the constraints.

Han You

Joined: Oct 26, 2003
Posts: 25
Ok, thanks for the feedback. My suspicion of not being able to modify constraints was confirmed. Good to know.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Check Constraints
It's not a secret anymore!