rules repository

G-9216

🆓
Warning

Always follow naming conventions for procedures.

Reason

SQL identifiers share the same namespace as PL/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.

Recommendations

Name is built from a verb followed by a noun. The name of the procedure should answer the question “What is done?”

Procedures and functions are often named with underscores between words because some editors write all letters in uppercase in the object tree, so it is difficult to read them.

Optionally prefixed by a project abbreviation.

Examples

  • calculate_salary
  • set_hiredate
  • check_order_state

Example

Non-Compliant Example

create or replace package department_api is
   -- ...
   procedure fermer_département(in_id in number);
end;
/
Issues
LineColumnMessage
314procedure fermer_département does not match '^[a-z][a-z0-9$#_]*$'.

Explanation

We do not want accented letters in procedure names.

Compliant Solution - ★★★★★

create or replace package department_api is
   -- ...
   procedure fermer_departement(in_id in number);
end;
/

Explanation

All accented letters are replaced with plain Latin letters.

Parameters

Use parameters to customize the rule to your needs.

ParameterDescriptionDefault Value
ProcedurePatternCase-insensitive regular expression pattern for procedures in PL/SQL packages and types.^[a-z][a-z0-9$#_]*$

References