Home
Identifiers should be written in lower case
Description
The PL/SQL code rule "Identifiers should be written in lower case" states that all identifiers (such as variable names, procedure names, and table names) should be written using only lower case letters. This rule is important for readability and consistency, as well as to avoid potential conflicts with other identifiers. Additionally, this rule helps to ensure that code is compatible with different databases and platforms.
Key Benefits
- Consistency: Identifiers written in lower case provide consistency in coding style.
- Readability: Lower case identifiers are easier to read and understand.
- Efficiency: Lower case identifiers are more efficient to type and process.
Non-compliant Code Example
DECLARE oracleQuery VARCHAR2(600); --Non compliant code (Identifiers are in mixed case) new_Custid NUMBER(8); --Non compliant code (Identifiers are in mixed case) new_FirstName VARCHAR2(50); --Non compliant code (Identifiers are in mixed case) new_LastName VARCHAR2(50); --Non compliant code (Identifiers are in mixed case) BEGIN oracleQuery := 'BEGIN CreateCustomer(:id, :Fname, :Lname); END;'; EXECUTE IMMEDIATE oracleQuery USING IN OUT new_Custid, new_FirstName, new_LastName; END;
Compliant Code Example
DECLARE oracle_query VARCHAR2(600); --Compliant code (Identifiers are in lower case) new_custid NUMBER(8); --Compliant code (Identifiers are in lower case) new_first_name VARCHAR2(50); --Compliant code (Identifiers are in lower case) new_last_name VARCHAR2(50); --Compliant code (Identifiers are in lower case) BEGIN oracle_query := 'BEGIN CreateCustomer(:id, :Fname, :Lname); END;'; EXECUTE IMMEDIATE oracle_query USING IN OUT new_custid, new_first_name, new_last_name; END;