• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Check Constraints

 
Han You
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 48382
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. I Googled and found this, whihc suggests you can't alter a constraint.
 
Agador Paloi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks for the feedback. My suspicion of not being able to modify constraints was confirmed. Good to know.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic