Re: FETCH

From: Frank van Bortel <fbortel_at_home.nl>
Date: Mon, 24 Dec 2001 19:00:32 +0100
Message-ID: <3C276D40.8B215F9D_at_home.nl>


Ivica Dimjasevic wrote:
>
> Hi! Let say I have PL/SQL procedure:
>
> CREATE OR REPLACE my_proc IS
>
> CURSOR my_cur SELECT * FROM my_table;
> my_rec my_cur%ROWTYPE;
>
> BEGIN
> OPEN my_cur;
>
> LOOP
> FETCH my_cur INTO my_rec;
> EXIT WHEN my_cur%NOTFOUND;
> ...
> END LOOP;
>
> -- Here I want to do it again with different code.
> LOOP
> FETCH my_cur INTO my_rec;
> EXIT WHEN my_cur%NOTFOUND;
> ...
> END LOOP;
>
> CLOSE my_cur;
> END;
>
> Is it possible to FETCH all rows again from the beginning without closing
> and reopening cursor?
> Thanks.
>
> --
> Ivica Dimjasevic
> http://come.to/smokesoft/

As you have exited the first loop, the second will never run: you'll have the same %notfound condition that caused the first to exit... Bet you have some other exits - right? OK - bad coding.
No - you must reopen your cursor; what are you trying to gain by not wanting that?

-- 
Gtrz,

Frank van Bortel
Received on Mon Dec 24 2001 - 19:00:32 CET

Original text of this message