Select a.Owner 外键拥有者,
a.Table_Name 外键表,
c.Column_Name 外键列,
b.Owner 主键拥有者,
b.Table_Name 主键表,
d.Column_Name 主键列,
c.Constraint_Name 外键名,
d.Constraint_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'
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;