How to see contents of Check Constraint on Oracle

回眸只為那壹抹淺笑 提交于 2019-12-23 07:22:24

问题


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?


回答1:


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.




回答2:


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.)



来源:https://stackoverflow.com/questions/2686353/how-to-see-contents-of-check-constraint-on-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!