G-9102
🆓Warning
Always follow naming conventions for local variables.
Reason
PL/SQL identifiers share the same namespace as SQL identifiers. Follow naming conventions to prevent naming conflicts, improve readability, and clearly indicate the scope without forcing the use of qualified names. A common practice is to use a prefix and/or suffix to distinguish the identifier types.
General local variables that are not based on a cursor, record, collection type or object type. However, this rules accepts patterns for cursor variables (G-9103), record variables (G-9104), collection variables (G-9105) and object variables (G-9106).
Example
Non-Compliant Example
declare some_name integer; begin null; end; /
Issues
Line | Column | Message |
---|---|---|
2 | 4 |
★★★★★
Compliant Solution -
declare l_some_name integer; begin null; end; /
Parameters
Use parameters to customize the rule to your needs.
Parameter | Description | Default Value |
---|---|---|
ObjectTypes | Comma-separated list of unqualified database object types. If empty, the installed object types are used. | , |
CollectionPattern | Regular expression pattern for PL/SQL local variables of type array/table. | (?i)^t_[a-z0-9$#_]+$ |
ObjectPattern | Regular expression pattern for PL/SQL local variable of SQL object type. | (?i)^o_[a-z0-9$#_]+$ |
CollectionTypes | Comma-separated list of unqualified database collection types. If empty, the installed collection types are used. | , |
LocalVariablePattern | Regular expression pattern for PL/SQL common local variables. | (?i)^l_[a-z0-9$#_]+$ |
RecordPattern | Regular expression pattern for PL/SQL local variables of type record. | (?i)^r_[a-z0-9$#_]+$ |
CursorPattern | Regular expression pattern for PL/SQL local variables of type cursor. | (?i)^c_[a-z0-9$#_]+$ |