Friday, March 29, 2013

How can I find which tables reference a given table in Oracle

SELECT table_name
  FROM ALL_CONSTRAINTS
 WHERE constraint_type = 'R'
   AND r_constraint_name IN (
           SELECT constraint_name
             FROM ALL_CONSTRAINTS
            WHERE table_name = 'TEST'
              AND constraint_type IN ('U', 'F','P')
         )

No comments:

Post a Comment