-3

If I have a table "Person", with a primary key 'ID', how can I see a list of tables with foreign keys that points to the "ID" column in the "Person" table?

Ben
  • 50,172
  • 36
  • 122
  • 141
aIKid
  • 24,039
  • 4
  • 38
  • 65

1 Answers1

2

Use the ALL_CONSTRAINTS system view.

select table_name
  from all_constraints
 where r_owner = 'OWNER'
   and r_constraint_name = 'YOUR_PRIMARY_KEY'

R_OWNER is the owner of the primary key and R_CONSTRAINT_NAME is the name of the primary key.

Ben
  • 50,172
  • 36
  • 122
  • 141