Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Doubt about cursors
Hi Folks,
I have the following code im pl/sql in a procedure:
r1 c1%rowtype; counting number(5); cod_1_previous number(5); BEGIN open c1; loop fetch c1 into r1; exit when c1%notfound; counting := 1; cod_1_previous := r1.cod_1; while cod_1_previous = r1.cod_1 loop DBMS_OUTPUT.PUT_LINE('Rec = '||r1.cod_1||'-'||r1.code_2||'-'||counting); counting := counting + 1; fetch c1 into r1; end loop; end loop; close c1;
My doubt is:
Is this the best construction considering that I need to call FETCH inside the loop? Is there a better way?
Thanks to everyone in advance.
Oswaldo Castro Received on Sun Apr 17 2005 - 10:05:57 CDT