dgfd hgfhg
dgfd hgfhg

Reputation: 105

query to modify the constraint in oracle

I have the below query from oracle query point of view is that I have created a constraint on table BOA_INVOICE as shown below

ALTER TABLE BOA_INVOICE ADD CONSTRAINT CK_INVOICE_SOURCE_SYSTEM CHECK ( SOURCE_SYSTEM IN ('PCE','PDS'));

Now this constraint is added successfully , but later on i want to modify same constraint add two values as shown below

 ALTER TABLE BOA_INVOICE ADD CONSTRAINT CK_INVOICE_SOURCE_SYSTEM CHECK ( SOURCE_SYSTEM IN ('PCE','PDS','PER','AWE'));

Please advise what will be the query to achieve the same

Upvotes: 2

Views: 59

Answers (1)

Jorge Campos
Jorge Campos

Reputation: 23361

You need to drop the constraint first and then create it again.

 ALTER TABLE BOA_INVOICE  DROP CONSTRAINT CK_INVOICE_SOURCE_SYSTEM;

Then Create it again:

 ALTER TABLE BOA_INVOICE ADD CONSTRAINT 
      CK_INVOICE_SOURCE_SYSTEM CHECK ( SOURCE_SYSTEM IN ('PCE','PDS','PER','AWE'));

Upvotes: 5

Related Questions