Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: [Fwd: PL/SQL - Commits in a update cursor]
According to documentation on ORA-01002:
"...an attempt was made to FETCH from an active set after all records have been fetched."
Since the PL/SQL cursor loop fetches implicitly, and you are likely using a SELECT FOR UPDATE statement to perform the update, the commit after the fetch is illegal. I don't know of a way to do it in the manner you provided. You would have better luck explicitly performing the FETCH yourself by opening the cursor yourself and so on...
-MD-
CJ wrote:
>
> ------------------------------------------------------------------------
>
> Subject: PL/SQL - Commits in a update cursor
> Date: Wed, 28 Jul 1999 11:47:12 -0700
> From: CJ <djjr_at_ix.netcom.com>
> Organization: Netcom
> Newsgroups: comp.databases.oracle.tools
>
> Anyone have any sample code on how to commit every X,000 records in a
> update cursor?
> I get the following error : ORA-01002: fetch out of sequence
> Can it be done? My code looks something like this :
>
> For r_rec in rec_cursor loop
> /* Updates here */
>
> rec_cnt := rec_cnt + 1;
> if (rec_cnt mod 10000=0)
> commit;
> end if
> end loop;
>
> TIA
Received on Wed Jul 28 1999 - 16:50:07 CDT