Home

Types should follow a naming convention

Description

    The rule "Types should follow a naming convention" states that all PL/SQL types should be named in a consistent and logical manner. This helps to ensure that the code is easier to read and understand. Naming conventions should include prefixes, suffixes, and capitalization to distinguish between different types. For example, a type that stores a customer's name could be named "CUST_NAME_TYPE". This helps to make the code more readable and easier to maintain. Additionally, it can help to prevent naming conflicts between different types.

Key Benefits

  • Consistency: Types should follow a naming convention to ensure consistency across the codebase.
  • Ease of Use: Naming conventions make it easier to understand the codebase and quickly identify the purpose of each type.
  • Reduce Errors: Following a naming convention can help reduce errors by making it easier to identify typos and other mistakes.

 

Non-compliant Code Example

DECLARE
  TYPE CustNameType_ IS TABLE OF cust.FirstName%TYPE  --Non compliant code (Types is not following the naming convention)
      INDEX BY BINARY_INTEGER;

BEGIN
	NULL;
END;

Compliant Code Example

DECLARE
  TYPE CustNameType IS TABLE OF cust.FirstName%TYPE  --Compliant code (Types following the naming convention)
      INDEX BY BINARY_INTEGER;

BEGIN
	NULL;
END;
Visual Expert 2024
 VEPLSQLRULE119