记录在表:user_constraints
a.table_name, --主键表
b.column_name, --主键列
c.OWNER, --外键拥有者
c.table_name, --外键表
d.column_name --外键列
from user_constraints a
left join user_cons_columns b
on a.constraint_name=b.constraint_name
left join user_constraints c
on c.R_CONSTRAINT_NAME=a.constraint_name
left join user_cons_columns d
on c.constraint_name=d.constraint_name
where a.constraint_type='P'
and a.table_name='xxx' --需要查看主外键关系的表
order by a.table_name