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: ORA-01002 Fetch out of sequence

Re: ORA-01002 Fetch out of sequence

From: Paul Simmons <famine_at_death.iinet.net.au>
Date: Tue, 11 May 1999 09:03:09 +0800
Message-ID: <373781CD.8A25F779@death.iinet.net.au>


> I can't see all your code. However, i'll assume you have this snippet in
> some kind of loop and are trying to perform a commit after each iteration of
> the loop.
> If you are using the 'for update' clause, commits are not allowed and hence
> will mess up the fetching sequence.

More to the point it is good to remember that any commit before a cursor is closed will close the cursor(s)

> declare
>
> cursor c1 (v_clientref in varchar2) is
> select * from client
> 'where client_reference=v_ClientRef;
>
> begin
>
> for data in c1(???client_reference??) loop
>
> update client
> set ???? = ????
> where client_reference = data.client_reference;
>
> commit;

Hence this is commiting your update and closing the cursor, next fetch can not be achieved because you have closed the cursor, hence the error.

> end loop;
>
> end;

--
Regards

Paul Simmons Received on Mon May 10 1999 - 20:03:09 CDT

Original text of this message

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