获取用户的主外键表关系
select
A.OWNER "用户名称",
c.TABLE_NAME "主键表",
d.COLUMN_NAME "主键字段",
B.R_CONSTRAINT_NAME "主键约束",
a.TABLE_NAME "外键表",
a.COLUMN_NAME "外键字段",
A.constraint_name "外键约束"
from user_cons_columns a,user_constraints b,user_constraints C,user_cons_columns D
where a.constraint_name = b.constraint_name
and B.constraint_type = 'R'
And B.R_CONSTRAINT_NAME=C.CONSTRAINT_NAME
And C.constraint_type = 'P'
And C.constraint_name =D.constraint_name