SELECT A.owner 外键拥有者,
A.table_name 外键表,
A.constraint_type 外键类型,
A.constraint_name 外键名称,
C.column_name 外键列,
b.owner 主键拥有者,
b.table_name 主键表,
b.constraint_type 主键类型,
b.constraint_name 主键名称,
d.column_name 主键列
FROM user_constraints A,
user_constraints b,
user_cons_columns C,
user_cons_columns d
WHERE A.r_constraint_name = b.constraint_name
AND A.constraint_type = 'R'
AND (b.constraint_type = 'P' or b.constraint_type = 'U')
AND A.r_owner = b.owner
AND A.constraint_name = C.constraint_name
AND b.constraint_name = d.constraint_name
AND A.owner = C.owner
AND A.table_name = C.table_name
AND b.owner = d.owner
AND b.table_name = d.table_name
查询Oracle数据库的外键关联的2张表
最新推荐文章于 2023-05-26 06:52:16 发布