Skip to main content

Variables should comply with a naming convention

ZPA rule for PL/SQL and Oracle SQL · VariableName

A naming convention lets a reader tell a variable from a column, a parameter or a constant at a glance. Names that follow it are easier to search and harder to confuse.

This rule reports a variable whose name does not match the regular expression of the regexp parameter. By default it is [a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?: a name that starts with a letter and does not end with an underscore.

Examples​

Noncompliant Code Example
declare
rack_label_ rack.label%type; -- Noncompliant
begin
select label into rack_label_ from rack where id = 42;
end;
Compliant Solution
declare
rack_label rack.label%type;
begin
select label into rack_label from rack where id = 42;
end;