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: Alternative way to write delete query

Re: RE: Alternative way to write delete query

From: <rgaffuri_at_cox.net>
Date: Tue, 27 May 2003 04:20:35 -0800
Message-ID: <F001.005A30E8.20030527042035@fatcity.com>


it depends on how many records are in each table.

if thare are more records in the table being deleted from than in the two tables in the subquery combined, use in. if its the other way around, test it with exists.
>
> From: "Naveen Nahata" <naveen_nahata_at_mindtree.com>
> Date: 2003/05/27 Tue AM 02:41:44 EDT
> To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
> Subject: RE: Alternative way to write delete query
>
> delete from table
> where column in (select col_a from table_b)
> or column in (select col_b from table_b)
>
> Can't say whether the performance will *really* be increased or not but
> 'explain plan' definitely looks much better :-)
>
> Regards
> Naveen
>
>
> > -----Original Message-----
> > From: Mark Richard [mailto:mrichard_at_transurban.com.au]
> > Sent: Tuesday, May 27, 2003 10:57 AM
> > To: Multiple recipients of list ORACLE-L
> > Subject: Alternative way to write delete query
> >
> >
> > Hi List,
> >
> > I'm having a mental blank and looking for suggestions... I'm
> > trying to
> > remember alternative ways to write the below query:
> >
> > delete from table
> > where column in (select col_a
> > from table_b
> > union all
> > select col_b
> > from table_b);
> >
> > Having said that, I don't mind if you simplify the nested
> > query down to
> > "select col_a from table_b" even. I just have a feeling that
> > I've seen an
> > equivalent query written totally differently but I can't
> > remember how. I
> > have a feeling it effectively allows more than one table to
> > be mentioned in
> > the delete without needing a nested query (like the options
> > available in
> > normal selects).
> >
> > Any suggestions?
> >
> > Thanks,
> > Mark.
> >
> > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>
> > >>>>>>>>>>>>>>>>>>
> > Privileged/Confidential information may be contained in
> > this message.
> > If you are not the addressee indicated in this message
> > (or responsible for delivery of the message to such person),
> > you may not copy or deliver this message to anyone.
> > In such case, you should destroy this message and kindly
> > notify the sender
> > by reply e-mail or by telephone on (61 3) 9612-6999.
> > Please advise immediately if you or your employer does not
> > consent to
> > Internet e-mail for messages of this kind.
> > Opinions, conclusions and other information in this message
> > that do not relate to the official business of
> > Transurban City Link Ltd
> > shall be understood as neither given nor endorsed by it.
> > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>
> > >>>>>>>>>>>>>>>>>>
> >
> >
> > --
> > Please see the official ORACLE-L FAQ: http://www.orafaq.net
> > --
> > Author: Mark Richard
> > INET: mrichard_at_transurban.com.au
> >
> > Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> > San Diego, California -- Mailing list and web hosting services
> > ---------------------------------------------------------------------
> > 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).
> >
> >
>
>
> DISCLAIMER:
> This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Naveen Nahata
> INET: naveen_nahata_at_mindtree.com
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> 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).
>
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: <rgaffuri_at_cox.net
  INET: rgaffuri_at_cox.net

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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 Tue May 27 2003 - 07:20:35 CDT

Original text of this message

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