rules repository

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
LineColumnMessage
94Object variable dept does not match '(?i)^o_[a-z0-9$#_]+$'.

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.

ParameterDescriptionDefault Value
ObjectTypesComma-separated list of unqualified database object types. If empty, the installed object types are used.,
ObjectPatternRegular expression pattern for PL/SQL local variable of SQL object type.(?i)^o_[a-z0-9$#_]+$

References