web analytics

Oracle: find dependent objects

This query helps to find the objects, that depend from the specified one

SELECT CONSTRAINT_NAME, OWNER,TABLE_NAME FROM DBA_CONSTRAINTS WHERE R_CONSTRAINT_NAME IN ( SELECT CONSTRAINT_NAME FROM dba_constraints WHERE OWNER=UPPER(’&user_dependent_from’) AND TABLE_NAME=UPPER(’&object_dependent_from’)  ) AND STATUS=’ENABLED’;

Example:

CREATE TABLE city ( city_id int , name CHAR(10) , PRIMARY KEY ( city_id ) ) ; CREATE TABLE country ( […]