Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Fetch out of sequence in cursor
PAUL MADDSION wrote:
> Hi,
>
> I have a cursor which loops through a table and does some processing.
> Towards the end of the loop I update another table and I want to COMMIT each
> record in turn. I'm getting a fetch out of sequence message when i try to
> run this and believe it is because I'm trying to commit within the cursor
> loop. Any suggestions on how I can get round this would be greatly
> appreciated. An outline of what I'm trying to do is shown below.
>
> Thanks in advance.
>
> PROCEDURE update_rec
> IS
Unless you have a version prior to 9i dump the cursor loop and use BULK COLLECT and FORALL. No loops. and put your COMMIT as the last item before the exception handler. Commits embedded in loops are a very bad practice and the specific cause your your current pain.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Tue Aug 29 2006 - 13:42:43 CDT