-1

How to find the total number of orphan records in a schema in oracle. Result should be displayed as Child_table,Parent_table, No. of orphan records

1 Answers1

0

How do would the database know there is an orphan record?

If you have foreign key constraints set up on the tables then you should not have any orphan records unless you are allowing NULL values in the foreign key or using ON DELETE SET NULL - in which case you just need to go through every foreign key in the data dictionary and count the NULL values in the foreign key columns of those tables.

MT0
  • 143,790
  • 11
  • 59
  • 117