Re: Return in anonymous PL/SQL block
Date: 12 Mar 2004 12:35:59 -0800
Message-ID: <32fe19ad.0403121235.5520088f_at_posting.google.com>
"Volker Hetzer" <volker.hetzer_at_ieee.org> wrote in message news:<c2sjnp$ful$1_at_nntp.fujitsu-siemens.com>...
> "Rolf Unger" <rolf.unger_at_ctilabs.de> schrieb im Newsbeitrag news:32fe19ad.0403120620.8e65ab1_at_posting.google.com...
> > Hi,
> >
> > i'm dealing with the problem that i want to stop processing in
> > an anonymous PL/SQL block.
> >
> > [ ... more lines "folded" ...]
>
> Actually, C does the same thing:
> int f(void)
> {
> int i;
> i=i+1;
> //whatever code
> {
> int j;
> return i;
> }
> }
> return returns from the function.
Yes, but in C you are always inside a function. So there always is a clear context (and stack!) to which the "return" relates too. And as I said I'm absolutely d'accord with the behaviour of "return" inside of PL/SQL functions.
I still think that a return that is not surrounded by a function or a procedure is not intuitive.
An anonymous block is compiled and immediately executed. A function or a procedure are compiled and only executed if they are referenced or called in some other context.
Maybe this discussion is just hypothetical and I have to change my coding guidelines and follow the simple rule:
"Never put more than five lines of code in an anonymous block. If you have more code, make it a function."
Then in 99 percent of the cases any "return" will be inside a function, and my C-aligned conscience will shut up ;-)
Rolf. Received on Fri Mar 12 2004 - 21:35:59 CET