Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: why 1002-fetch out of sequence?
Andrew P.Sandimirov wrote in message <79tnin$cgn$1_at_ss20.vaz.ru>...
>Hello All.
>Why in IF block commit make error:
>ORA-01002: fetch out of sequence
> [snip]
>
>OPEN NS1;
>LOOP
>FETCH NS1 INTO NS_RECORD;
>EXIT WHEN NS1%NOTFOUND;
> update NS set PRIM = PRIM WHERE CURRENT OF NS1;
> IF MOD(ns1%rowcount,100) = 0 THEN
> COMMIT WORK; /* it is HERE*/
> END IF;
> END LOOP;
>CLOSE NS1;
It's because Oracle won't let you fetch from an open cursor once you've
committed work against that cursor.
Change your update statement to be:
update NS set PRIM = PRIM WHERE NS.ROWID =NS1.ROWID
and it should work. ( Assuming, of course, that you modify your declaration of the NS1 cursor to include ROWID. )
Dave.
--
Remove "nospam" from my address to reply by email
Received on Thu Feb 11 1999 - 17:39:04 CST