1. Home
  2. Knowledge Base
  3. Database Administration
  4. Check for dependant foreign keys before dropping Primary Key
  1. Home
  2. Knowledge Base
  3. Scripts
  4. Check for dependant foreign keys before dropping Primary Key

Check for dependant foreign keys before dropping Primary Key

SELECT A.owner foreign_owner, a.table_name foreign_table, b.owner primary_owner, b.table_name primary_table
from dba_constraints a, dba_constraints b
where a.r_constraint_name = b.constraint_name and a.constraint_type = 'R'
and b.constraint_type = 'P' and b.table_name = 'DEPT';

The following two tabs change content below.

Gavin Soorma

Latest posts by Gavin Soorma (see all)

Updated on June 2, 2021

Was this article helpful?

Related Articles

Leave a Comment