G-9104
🆓Warning
Always follow naming conventions for record 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 a record type. Can only be distinguished from general local variables if the record type is declared in the same file.
Example
Non-Compliant Example
declare
emp emp%rowtype;
type r_dept_type is record(
deptno number,
dname varchar2(14 char),
loc varchar2(13 char)
);
dept r_dept_type;
begin
null;
end;
/Issues
| Line | Column | Message |
|---|---|---|
| 2 | 4 | |
| 8 | 4 |
Compliant Solution - ★★★★★
declare
r_emp emp%rowtype;
type r_dept_type is record(
deptno number,
dname varchar2(14 char),
loc varchar2(13 char)
);
r_dept r_dept_type;
begin
null;
end;
/Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| RecordPattern | Regular expression pattern for PL/SQL local variables of type record. | (?i)^r_[a-z0-9$#_]+$ |
References
- same as plsql:NamingRecordField