| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Fetch out of sequence in cursor
oradbamohan_at_gmail.com wrote:
> Hi,
>
> declare
> cursor c1 is select * from emp1;
> c_rec c1%ROWTYPE;
> begin
> open c1;
> loop
> fetch c1 into c_rec;
> exit when c1%notfound;
> -- here you use the your 'update' and 'commit' statements
> -- it wont come from the endof file encounter.
> dbms_output.put_line('the emp rec..'||c_rec.ename);
> end loop;
> close c1;
> end;
>
>
>
> PAUL MADDSION wrote:
PROCEDURE update_rec IS
TYPE myarray IS TABLE OF <table_name>%ROWTYPE; l_data myarray;
CURSOR c_record IS
SELECT *
FROM <table_name>
WHERE <some_condition>;
BEGIN
OPEN c_record;
LOOP
FETCH c_record BULK COLLECT INTO l_data LIMIT 500;
FORALL i IN 1..l_data.COUNT
UPDATE STATEMENT ...;
EXIT WHEN r%NOTFOUND;
I like to discourage legacy cursor loop single-row processing.
-- 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 Wed Aug 30 2006 - 13:39:55 CDT
![]() |
![]() |