Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: ORA-01002 Fetch out of sequence
> 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