如何查找子表的Root表?
例如: -
I have 26 tables A,B,C ...Z. I need to find the indirect relation for particular table
B has relation with A
C has relation with B
If i will give the table_name like c, it will come to A(indirect relation)
答案 0 :(得分:1)
您可以尝试在user_constraints
PK
是constraint_type = 'P'
FK
为constraint_type = 'R'
,并通过r_constraint_name
沿着这条线的某些东西可能有效(未经测试)
select table_name
from user_constraints
start with
table_name = 'x'
and constraint_type = 'P'
connect by r_constraint_name = prior constraint_name
and prior constraint_type = 'R'