Chris
Chris

Reputation: 1262

How to see contents of Check Constraint on Oracle

I did not create the database I'm working with, but I would like to see the details of a check constraint.

I know a check constraint on a column is enforcing a set of specific values, and I'd like to know what those values are. For example, if a check constraint is enforcing the character 'Y' and 'N', I want to be able to query the database and see that the accepted values are 'Y' and 'N.'

Is this possible to do through a query?

Upvotes: 10

Views: 24012

Answers (2)

Matt
Matt

Reputation: 928

Don't forget that the columns in the all_constraints table are case-sensitive. If your select statement returns nothing, that may be why.

(If I had enough rep to comment, on DBA's answer, this would go there.)

Upvotes: 0

DBA
DBA

Reputation: 206

select constraint_name,search_condition 
from all_constraints
where table_name='NAME_OF_YOUR_TABLE'
and constraint_type='C';

Will list the check and the constraint name of all check constraints on a specific table.

Upvotes: 19

Related Questions