G-7320: Avoid using RETURN statements in a PROCEDURE.
Major
Maintainability, Testability
Reason
Use of the return
statement is legal within a procedure in PL/SQL, but it is very similar to a goto
, which means you end up with poorly structured code that is hard to debug and maintain.
A good general rule to follow as you write your PL/SQL programs is "one way in and one way out". In other words, there should be just one way to enter or call a program, and there should be one way out, one exit path from a program (or loop) on successful termination. By following this rule, you end up with code that is much easier to trace, debug, and maintain.
Example (bad)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Example (good)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|