joy_jlee
joy_jlee

Reputation: 113

drop check constraint when constraint name is not known

Is it possible to delete check constraint(no constraint name declared) that is created within CREATE TABLE command?

Upvotes: 3

Views: 3210

Answers (1)

Pரதீப்
Pரதீப்

Reputation: 93754

Run the below query to find the list of check constraints in your table, including what they are checking for:

select constraint_name, search_condition
from user_constraints 
where table_name = 'Your table name'
and constraint_type = 'C' -- To filter Check constraints alone

Copy the name of the relevant constraint and paste it in the Alter table drop constraint command.

Alter Table Your_table_name 
       Drop Constraint constraint_name; -- Replace constraint_name from above query result

Upvotes: 5

Related Questions