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

Home -> Community -> Usenet -> c.d.o.server -> Re: why 1002-fetch out of sequence?

Re: why 1002-fetch out of sequence?

From: Dave Wotton <Dave.Wotton_at_dwotton.nospam.clara.co.uk>
Date: Thu, 11 Feb 1999 23:39:04 GMT
Message-ID: <sSJw2.5447$cQ5.2826@nnrp2.clara.net>

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

Original text of this message

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