How to get dependent table name by query

Posted on 2004-09-10
Medium Priority
Last Modified: 2012-05-05
For a given table, how can I get the table names which depend on it  by query?

Question by:oldyyy
LVL 23

Expert Comment

ID: 12032002
you mean in Oracle? and you mean child tables(FK tables) by dependent tableS?
LVL 14

Assisted Solution

by:Muhammad Ahmad Imran
Muhammad Ahmad Imran earned 450 total points
ID: 12032183
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

LVL 13

Accepted Solution

riazpk earned 1050 total points
ID: 12034057

Author Comment

ID: 12044804

Thanks all.
 for seazodiac
 Yes, I  mean in oracle to get child tables(FK tables) by dependent tableS.
LVL 13

Expert Comment

ID: 12053070
Please finalize this question and award the points.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
An introductory discussion about Oracle Analytic Functions which are used to calculate or compute Aggregate values, based on a group of rows.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to take different types of Oracle backups using RMAN.

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question