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

Home -> Community -> Mailing Lists -> Oracle-L -> PL SQL cursor help

PL SQL cursor help

From: Stephen Andert <StephenAndert_at_firsthealth.com>
Date: Fri, 19 Mar 2004 19:16:02 -0700
Message-ID: <s05b4700.049@SLCM02.firsthealth.com>


I've been RTFM's and Googling and I've gotten this far, but now I'm tired and want to go home so I hope someone has fresh eyes to assist.

I'm testing for a table update that will update 27 million rows of a 150 million row table (sma) with a value from a second table (mr15421). My goal is to run one command and update 27 million rows 10,000 or so at a time.

This code works, but when I take out the comments in front of the commit, I get an error:
declare
*
ERROR at line 1:
ORA-01002: fetch out of sequence
ORA-06512: at line 12

It is probably something basic that I'm overlooking. I hope one of you will see it and point it out to me.

Thanks
Stephen

declare
  i number := 0;
  cursor s1 is SELECT * FROM sma a WHERE

     exists (select 1 from mr15421 b
        where a.sched_id = b.sched_id
        and a.proc_cd = b.proc_cd
        and a.proc_catg_cd = b.proc_catg_cd
        and a.compnnt_typ_cd = b.compnnt_typ_cd
        and a.eff_dt = b.eff_dt)
     FOR UPDATE;

begin

   for c1 in s1 loop
dbms_output.put_line (i);
 i := i +1;
 if i > 2 then
 dbms_output.put_line (i);
-- commit;

    i := 0;
 end if;
 end loop;
-- commit;

end;
/



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

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--

Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
Received on Fri Mar 19 2004 - 20:13:00 CST

Original text of this message

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