April 2001
Intermediate to advanced
204 pages
5h 10m
English
STYL-04: Tag module END statements with module names.
Every program (indeed, every block of code; see [STYL-06: Self-document using block and loop labels. ]) has an END statement. You can, and should, append the name of the program to the end statement:
CREATE OR REPLACE PACKAGE BODY <pkgname>
IS
PROCEDURE <procname> (...)
IS BEGIN
...
END <procname>;
PROCEDURE <funcname> (...)
IS BEGIN
...
END <funcname>;
END <pkgname>;My package consists of 243 procedures and functions, stretching to over 5,000 lines. Without END labels, I could easily be confronted with code like this:
END LOOP; END; END;
Yikes! Wouldn’t it be so much better if my code had instead been written like this:
END LOOP yearly_analysis; END best_seller_review; END book_usage_pkg;
This is merely good form for standalone programs. For packaged procedures and functions with code that goes on for hundreds or thousands of lines, however, named ENDs are crucial to improving the readability of that package.
Read now
Unlock full access