Title: Message
 
delete from childtable a
  where not exists (select 1 from parenttable b where b.key1=a.key1 and b.key2=a.key2...) ;
 
try it as -
 
select * from childtable a
  where not exists (select 1 from parenttable b where b.key1=a.key and b.key2=a.key2...) ;
 
to make sure it is going to delete what you think it is.
 
HTH,
 
Beth
-----Original Message-----
From: Richard Huntley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 13, 2002 12:59 PM
To: Multiple recipients of list ORACLE-L
Subject: Cleanup of child records...

TIA List,

What is the most efficient way to remove child records from a table
that have no parent records in it's parent table. I want to build a FK,
to keep this from happening, but I need to do some cleanup first.


Reply via email to