 |
|
ss
Oracle Tips by Burleson |
Code Readability in PL/SQL
Code readability is important when programming.
Many times lines can be combined to reduce the size of the code but
may make the code less understandable to anyone other than the
author. The example shown earlier can in fact be written with only
three lines of code.
SQL> begin
2 dbms_output.put_line ('Hello &v_string');
3 end;
4 /
Enter value
for v_string: John
Hello John
White Space and Comments
As with any programming, you want your script to
be as readable as possible. Remember, you may be writing the
procedure but more than likely someone else will have to update and
maintain it.
White space is added to make code more readable.
It has no impact on the execution time or efficiency of the code.
White space is use only to make the code more readable to humans. In
the examples above, the code between the begin and end
key word is indented. This makes the block boundaries easier to see
in the code. The two spaces forming the indent exists only to make
the code easier to read. Blank lines can also be used to separate
sections of code. Blank lines can appear anywhere in the code (except
inside a SQLstatement).
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
|