oracle - How to find the root table for child table? -
how find root table child tables ?
for example : -
have 26 tables a,b,c ...z. need find indirect relation particular table b has relation c has relation b if give table_name c, come a(indirect relation)
you can try , use hierarchical query on user_constraints
pk
constraint_type = 'p'
fk
constraint_type = 'r'
, linked primary key r_constraint_name
something along lines might work ( not tested )
select table_name user_constraints start table_name = 'x' , constraint_type = 'p' connect r_constraint_name = prior constraint_name , prior constraint_type = 'r'
Comments
Post a Comment