G-9106
🆓Warning
Always follow naming conventions for object 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.
Local variables for an object type. Can only be distinguished from general local variables if the list of SQL object types is provided as a static list or retrieved from the Data Dictionary.
Example
Non-Compliant Example
create or replace type dept_type as object ( deptno integer, dname varchar2(14 char), loc varchar2(13 char) ); / declare dept dept_type; begin null; end; /
Issues
Line | Column | Message |
---|---|---|
9 | 4 |
★★★★★
Compliant Solution -
create or replace type dept_type as object ( deptno integer, dname varchar2(14 char), loc varchar2(13 char) ); / declare o_dept dept_type; 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. | , |
ObjectPattern | Regular expression pattern for PL/SQL local variable of SQL object type. | (?i)^o_[a-z0-9$#_]+$ |
References
- similar to plsql:NamingVariablesCheck
The scope of plsql:NamingVariablesCheck is all variables, not just object variables.