Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Cursor For Loops

Re: Cursor For Loops

From: Phil Herring <revdoc_at_uow.edu.au>
Date: 26 Apr 1998 23:40:06 GMT
Message-ID: <6i0gkm$mtg$1@wyrm.its.uow.edu.au>


In article <353EC784.F3BB304E_at_deakin.edu.au> David Temple, temple_at_deakin.edu.au writes:
>Reading Oracle PL/SQL by Steven Feuerstein I find that it is a mortal
>sin to RETURN in the middle of a cursor for loop, although the author
>does not give a solid explanation of why, except to say that this is bad
>programming practice. Does anyone have a more thorough explanation?

It's not really to do with PL/SQL per se... it's a bad practice in any language. From an aesthetic standpoint, the loop condition should always be used to exit the loop, because your code is more elegant that way; from a pragmatic standpoint, it's possible that someone will read your code, assume that your loop condition is the only way that the loop will exit, and miss seeing the RETURN or EXIT buried deep inside the loop body.

Any introductory book on programming will cover this in much more detail that you need to know :)



Copyright 1998 Phil Herring. This article may not be reproduced for profit.
Received on Sun Apr 26 1998 - 18:40:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US