select c.constraint_name, c.owner, c.table_name, colr.column_name col, colr.position, cr.owner ref_owner, cr.constraint_name ref_constraint, cr.constraint_type ref_type, col.table_name ref_table, col.column_name ref_col from all_constraints c, all_constraints cr, all_cons_columns col, all_cons_columns colr where c.constraint_type = 'R' and c.r_constraint_name = cr.constraint_name and c.r_owner = cr.owner and c.r_constraint_name = col.constraint_name and c.r_owner = col.owner and c.constraint_name = colr.constraint_name and c.owner = colr.owner and col.position=colr.position ORDER BY c.owner, c.table_name, c.constraint_name, colr.position;