Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Updating datefield in tables?
I believe the 'commit' statement will implicitly close your cursor. What
you need is to wrap another loop around your current loop, that reopens your
cursor after each commit. You will have to make sure that you come out of
the outer loop when there are no more updates to do, by checking when the
inner loop updates 0 records. You will probably want to use rownum in your
cursor to only bring in the number of records you can process in one go.
yliu_at_creighton.edu wrote in message ...
>Hi All,
>
>Sorry I have to repost this topic again. When I run the following PL/SQL
>code,
>
>Begin
> FOR c1 in date_cursor LOOP
> update my_table
> set thrudate = to_date('31-dec-2099', 'dd-mon-yyyy')
> where current of date_cursor;
> num_updated=num_updated+1;
>
> -- Inserted code below between IF... and END IF... lines
> IF num_updated = 5000 THEN
> commit;
> num_updated = 0;
> END IF;
>
> END LOOP
>end;
>
>I got the error message saying
>"fetch out of sequence"
Received on Fri Apr 30 1999 - 16:01:09 CDT