Database : SQL to find reference tables


To find all tables that referenced “Organization” table use the following SQL query:

select table_name, constraint_name, status from user_constraints
where constraint_type = ‘R’
and r_constraint_name in
select constraint_name from user_constraints
where constraint_type in (‘P’, ‘U’)
and table_name = ‘ORGANIZATION’
order by table_name, constraint_name;

NOTE: In the query above ‘ORGANIZATION’ can be replaced with the name of any table you are interested in.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.