Re: PL/SQL For-loops vs explicit cursors

From: Michael Reviakin <misha_at_percombank.kiev.ua>
Date: 1995/07/25
Message-ID: <AA_RG5mir4_at_percombank.kiev.ua>#1/1


Instead of explisit declaring of cursor and then using its name in cursor FOR loop clause:

    CURSOR c IS SELECT ...
...

    FOR r IN c LOOP
...

    END LOOP; you may write simply:

    FOR r IN (SELECT ...) LOOP
...

    END LOOP; The benifits of this construction is doubtless and it is successfully used during last half-year but it happend that "lazy" cursor FOR loop have some peculiarities.

When I tried exit such a loop (placed iside function) via RETURN operator an "ORA-06501: PL/SQL internal error 1803" error was occured, although when using usual "explicitly declared" cursor FOR loop it was OK.

By the way, "PL/SQL User's Guide and Reference, Version 2.0" says nothing about exits cursor FOR loops via RETURN operator.

They said only that exiting via EXIT or GOTO or when EXCEPTION occured inside cursor FOR loop, corresponded cursor will be closed automatically.

Does anyone have complete information about this ?

     Best Regards
     Michael Reviakin
     PERKOMBANK
     Kiev Ukraine

P.S. This regards ORACLE7 Version 7.0.16 and PL/SQL Version 2.0 Received on Tue Jul 25 1995 - 00:00:00 CEST

Original text of this message