Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Cleanup of child records...

RE: Cleanup of child records...

From: Seefelt, Beth <Beth.Seefelt_at_TetleyUSA.com>
Date: Thu, 13 Jun 2002 09:48:52 -0800
Message-ID: <F001.0047D6BE.20020613094852@fatcity.com>

 

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-----
Sent: Thursday, June 13, 2002 12:59 PM
To: Multiple recipients of list ORACLE-L

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.

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Seefelt, Beth
  INET: Beth.Seefelt_at_TetleyUSA.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Jun 13 2002 - 12:48:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US