• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 599
  • Last Modified:

How to get dependent table name by query

Hi
For a given table, how can I get the table names which depend on it  by query?

Thanks
0
oldyyy
Asked:
oldyyy
2 Solutions
 
seazodiacCommented:
you mean in Oracle? and you mean child tables(FK tables) by dependent tableS?
0
 
Muhammad Ahmad ImranDatabase DeveloperCommented:
For Parent child relationship:

select p.table_name PARENT_TABLE, c.table_name CHILD_TABLE
from user_constraints p, user_constraints c
where (p.constraint_type = 'P' OR p.constraint_type = 'U')
and c.constraint_type = 'R'
and p.constraint_name = c.r_constraint_name
/

For dependant objects like procedure,functions,views:

SQL> @ utldtree -- find in yr database folder.
SQL> Execute deptree_fill('TABLE','SCOTT','EMP');

Here a message should display that the procedure successfully completed.

then you can query as

SQL> select * from deptree;
SQL> select * from ideptree;

Hope this help

LeoAhmad
0
 
oldyyyAuthor Commented:

Thanks all.
 for seazodiac
 Yes, I  mean in oracle to get child tables(FK tables) by dependent tableS.
0
 
riazpkCommented:
Please finalize this question and award the points.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now