您的位置:首页 > 大数据 > 人工智能

Display names of all constraints for a table in Or

2014-05-28 00:00 471 查看
You need to query the data dictionary, specifically the USER_CONS_COLUMNS view to see the table columns and corresponding constraints:
SELECT * FROM user_cons_columns WHERE table_name = '<your table name>';

FYI, unless you specifically created your table with a lower case name (using double quotes) then the table name will be defaulted to upper case so ensure it is so in your query.
If you then wish to see more information about the constraint itself query the USER_CONSTRAINTS view:
SELECT * FROM user_constraints WHERE table_name = '<your table name>' AND constraint_name = '<your constraint name>';

If the table is held in a schema that is not your default schema then you might need to replace the viewws with:
all_cons_columns

and
all_constraints

adding to the where clause:
AND owner = '<schema owner of the table>'

Hope it helps...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐