PKG-12: Use a standard format for packages that include comment headers for each type of element defined in the package.
Packages are likely to be the largest, most complex code elements of your application. The internal structure of a package (both the specification and the body) is usually composed of many different types of elements, including variables, user-defined types, functions, and procedures.
Your standard package format should help you organize the elements of a package, minimize the need for forward declarations, and make it easier for you to rapidly find constructs. Make the standard format available for developers either in a template file or by generating it upon command.
Here’s a template for a package body (see Section for where to find this code):
CREATE OR REPLACE PACKAGE BODY name IS /* PUT YOUR PACKAGE HEADER HERE */ /* Constants */ /* Variables */ /* Exceptions */ /* Types (records, collections, cursor variables) */ /* Private Programs */ /* Public Programs */ END name;
If everyone in your development team builds packages the same way, it will be easier to maintain the code base.
By separating code elements into distinct sections identified by headers, you can quickly find the desired code.
template.pks and template.pkb : Template files, one for the package specification and one for the body.
PLVgen: Use this package of the PL/Vision library to generate a package template, either to the screen or directly to a file.