-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
  • 51,770
  • 36
  • 127
  • 149
aIKid
  • 26,968
  • 4
  • 39
  • 65
  • Although this is indeed a duplication, I think it duplicates this [other Question](https://stackoverflow.com/questions/1143728/how-can-i-find-which-tables-reference-a-given-table-in-oracle-sql-developer), and not the one referenced by the message that Closed this answer on this current page here. – cellepo Mar 02 '23 at 23:06

1 Answers1

3

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
  • 51,770
  • 36
  • 127
  • 149