Think of all identifiers as consisting of 4 parts: <Scope><Type><Descriptive Identifier><Usage>.
Of the 4 elements only the descriptive identifier is required by Oracle. However, the other elements serve to make the name better self-documenting code. At UNF, the first three should always be used. The usage element need only be used when appropriate.
Scope is the locality of reference within a package, procedure, or function. Knowing this is invaluable to the maintenance programmer. We keep this simple with only three designations: global (g), local (l), and parameter (p).
The type portion of the name describes the identifier’s structure. There are simple types, such as constants and variables. In addition, there are more complex, aggregate types, such as records, tables, and cursors.
There are also special constructs that are available in PL/SQL. They are Type, Subtype and Cursor Variables.
Notice that we combine the scope with the type as the first portion of the identifier name.
Local record type
Parameter of ROWTYPE
The Descriptive Identifier is the most important part of a name. This can be a single word or a phrase. Deciding the lengths of names is always a trade off between length for documentation and brevity for typing purposes. So we want to be optimal. The name should pretty much tell the reader the purpose of the identifier. In most cases, the descriptive portion of the identifier should be comprised of a primary area such as student, address, or employee and a modifier that makes it more readable. The modifier(s) may precede and/or follow the primary area.
In certain cases, a suffix should be used to qualify the identifier further to document the usage of the variable. For example, a suffix is used to denote the type of parameter, as in IN, OUT, or IN OUT or to indicate that the variable is a FOR .. LOOP index (which is not declared).
Input only parameter
Output only parameter
Both input and output
FOR .. LOOP index
Copyright © 2014 University of North Florida1 UNF Drive | Jacksonville, FL 32224 | Phone: (904) 620-1000