 |
|
Oracle Tips by Burleson |
Improper
Loop Termination
Just because you can do something, doesn’t mean
you should do it. When a loop is implemented in PL/SQL it should
terminate in the designed manner. The PL/SQL WHILE loops terminate
when the test condition becomes false, and FOR loops terminate after
the defined number of iterations. The EXIT and EXIT WHEN
(condition = true) statements will exit all loops but should only be
used on endless loops. If you find that you need them on a FOR or
WHILE loop, you have probably chosen the wrong loop structure to
implement.
The GOTO statement should
never be used inside a loop to jump out of the loop. Using the GOTO
statement to terminate a loop will make your code harder to understand
and more difficult to maintain.
The above book excerpt is from:
Easy Oracle PL/SQL Programming
Get Started
Fast with Working PL/SQL Code Examples
ISBN 0-9759135-7-3
John Garmany
http://www.rampant-books.com/book_2005_1_easy_plsql.htm
|