select a.table_name ,a.column_name ,b.table_name ,b.column_name
from
(select a.constraint_name,b.table_name,b.column_name,a.r_constraint_name
from user_constraints a, user_cons_columns b
WHERE a.constraint_type='R'
and a.constraint_name=b.constraint_name
) a,
(select distinct a.r_constraint_name,b.table_name,b.column_name
from user_constraints a, user_cons_columns b
WHERE a.constraint_type='R'
and
a.r_constraint_name=b.constraint_name)
b
where a.r_constraint_name=b.r_constraint_name
and b.table_name = '主表名'
order by b.table_name
from
(select a.constraint_name,b.table_name,b.column_name,a.r_constraint_name
from user_constraints a, user_cons_columns b
WHERE a.constraint_type='R'
and a.constraint_name=b.constraint_name
) a,
(select distinct a.r_constraint_name,b.table_name,b.column_name
from user_constraints a, user_cons_columns b
WHERE a.constraint_type='R'
and
a.r_constraint_name=b.constraint_name)
b
where a.r_constraint_name=b.r_constraint_name
and b.table_name = '主表名'
order by b.table_name