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: Re[2]: Union quries: INTERSECT, MINUS, etc

Re: Re[2]: Union quries: INTERSECT, MINUS, etc

From: Rachel Carmichael <wisernet100_at_yahoo.com>
Date: Fri, 25 Jul 2003 06:26:51 -0700 (PDT)
Message-Id: <26013.339605@fatcity.com>


okay, I answered this offlist but...

it started out as "do we have a problem, indicated by records in the parent table with no children"

select id from parent
minus
select parentid from child

that identified that we had a problem.

next step (I'm a paranoid DBA when it comes to permanently deleting data from production)

create holding_table
as select * from parent
where id in
(select id from parent
minus select parentid from child)

last step

delete from parent where id in select id from holding_table

elegant? no. Fast? yes. And when I'm doing this 10 minutes before I'm supposed to leave for the day, fast is what I want :)

I'm a BIG believer in "plain vanilla" coding. Slick is fine, but if I have to spend too much more time than the slick query saves me in creating it, it's not worth it. This is a one-off.


Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software Received on Fri Jul 25 2003 - 08:26:51 CDT

Original text of this message

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