G-9112
🆓Warning
Always follow naming conventions for collection type definitions (arrays/tables).
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.
Example
Non-Compliant Example
declare type t_varray is varray(10) of string; type nested_table_type is table of string; type x_assoc_array_y is table of string index by pls_integer; begin null; end; /
Issues
| Line | Column | Message |
|---|---|---|
| 2 | 9 | |
| 3 | 9 | |
| 4 | 9 |
Compliant Solution - ★★★★★
declare type t_varray_type is varray(10) of string; type t_nested_table_type is table of string; type t_assoc_array_type is table of string index by pls_integer; begin null; end; /
Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| PlsqlCollectionTypePattern | Regular expression pattern for PL/SQL collection type definitions. | (?i)^t_[a-z0-9$#_]+_type$ |
References
- similar to plsql:NamingTypesCheck
The scope of plsql:NamingTypesCheck is all types, not just collection type definitions.