查看有关主键/外键约束的oracle元数据 [英] Viewing oracle's metadata about primary/foreign key constraints

查看:100
本文介绍了查看有关主键/外键约束的oracle元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个表包含有关约束的详细信息(例如,外键引用的表)?表'all_cons_columns','all_constraints'仅包含约束的名称,并不是很有用. 我目前正在使用dbms_metadata.get_ddl(),但是它不适用于所有数据库.

Which table contains detailed information(For example the table the foreign key is referring to) about the constraints? The tables 'all_cons_columns' , 'all_constraints' contains only the name of the constraints which isn't very helpful. I am currently using dbms_metadata.get_ddl() but it doesn't work on all the databases.

谢谢.

推荐答案

已全部包含:ALL_CONSTRAINTS中的R_CONSTRAINT_NAME列包含外键引用的PK/UK约束的名称.然后,您可以查找该约束以获得引用表的TABLE_NAME.

It is all in there: the column R_CONSTRAINT_NAME in ALL_CONSTRAINTS contains the name of the referenced PK/UK constraint for a foreign key. You can then look up that constraint to get the TABLE_NAME of the reference table.

查看ALL_CONS_COLUMNS时,外键中列的位置将与主键/唯一键中列的位置相匹配.

When looking at ALL_CONS_COLUMNS, the POSITION of the column in the foreign key will match the POSITION of the column in the primary/unique key.

这篇关于查看有关主键/外键约束的oracle元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆