TRACING RELATIONSHIP BETWEEN TABLES....
693241May 22 2009 — edited May 22 2009Hello all,
I use the below query to find the hierarchial relationship between tables ...
SELECT
c.table_name parent_table , c.column_name parent_column,b.table_name child_table ,b.column_name child_COLUMN ,LEVEL lrv
FROM USER_constraints a,user_cons_columns b ,user_cons_columns c
WHERE a.constraint_name = b.constraint_name
AND a.r_constraint_name = c.constraint_name
AND constraint_type = 'R'
AND b.table_name <> 'CNTRCT_PARENT'
START WITH b.table_name = 'CNTRCT_PARENT'
CONNECT BY NOCYCLE PRIOR b.table_name = c.table_name
ORDER BY c.table_name
but i need order like below,
parent table childtable1
childtable1 grantchildtable1
childtable1 grantchildtable2
parent table childtable2
childtable2 grantchildtable1
childtable2 grantchildtable2
childtable2 grantchildtable3
how this sort of order by is possible ...
Thanks in advance
Vijay G