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: ROWNUM - Can the inner-outer idea be extended to an update?

Re: ROWNUM - Can the inner-outer idea be extended to an update?

From: Daniel Fink <daniel.fink_at_sun.com>
Date: Wed, 09 Jul 2003 10:01:19 -0700
Message-ID: <F001.005C4171.20030709095424@fatcity.com>


IF you are looking to break up the update into more 'manageable' pieces, here is a thought...

UPDATE EMP2
SET GENDER = 'F'
WHERE GENDER = ' '
AND ROWNUM <= 100;

UPDATE EMP2
SET GENDER = 'F'
WHERE GENDER = ' '
AND ROWNUM <= 100;

*Since the first 100 records have already been updated, the second update will update the next 100. Run the statement several until you have updated all the records concerned. You can commit in between or not, as long as you do all this as one session.

MaryAnn Atkinson wrote:
>
> Can the inner-outer idea be extended to an update?
>
> UPDATE EMP2
> SET GENDER = 'F'
> WHERE GENDER = ' '
> AND ROWNUM BETWEEN 10 AND 20;
>
> That does NOT work, because as we explained the returned rows
> are numbered starting from 1, and so rownum never really matches
> a 10 or 20 or anything in between.
>
> Thanks,
> maa
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: MaryAnn Atkinson
> INET: [EMAIL PROTECTED]
>
> 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: [EMAIL PROTECTED] (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).begin:vcard
n:Fink;Daniel
tel;cell:303.808.3282
tel;work:303.272.3225
x-mozilla-html:TRUE
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:DB Services Lead
x-mozilla-cpt:;-4832
fn:Daniel Fink
end:vcard Received on Wed Jul 09 2003 - 12:01:19 CDT

Original text of this message

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