Site icon Voina Blog (a tech warrior's blog)

#SQL to find dependency between tables in #Oracle database

Advertisements

There are times when we need to find which are the tables that depend on a given table. This is useful when cleanup or archiving jobs have to pe performed and the interconnection of constraints is becoming a nuisance.

Lucky for us in the case of Oracle database is quite simple to search through all the constraints , as there exist a view called all_contraints.
The following query will search for all the constraints linked to the table MY_TABLE.

SELECT * FROM user_constraints WHERE table_name = ‘MY_TABLE’;

Exit mobile version