File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 46320
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 agree. Here's the link:
subject: Check Constraints
It's not a secret anymore!