Home
Function and procedure parameters should comply with a naming convention
Description
The rule "Function and procedure parameters should comply with a naming convention" states that all parameters used in functions and procedures should be named according to a specific convention. This helps to make the code more readable and easier to understand. It also helps to avoid naming conflicts between parameters and other objects in the database. The naming convention should be consistent across all functions and procedures in the database. This ensures that all parameters are easily identifiable and that the code is more maintainable.
Key Benefits
- Consistency and Readability: Ensures consistency and readability of code.
- Ease of Debugging: Makes it easier to identify and fix errors in code.
- Ease of Maintenance: Makes it easier to modify and extend existing code.
- Ease of Understanding: Makes it easier for other developers to understand code.
Non-compliant Code Example
procedure DeleteCloneCustomerById ( customer_Id_ in NUMBER ) --Non compliant code
IS
BEGIN
DELETE CloneCustomer where ID = customer_Id_;
COMMIT;
END DeleteCloneCustomerById
function GetFullName(fname_ in nvarchar2,lname_ in nvarchar2) return nvarchar2 --Non compliant code
IS
BEGIN
RETURN(CONCAT(CONCAT(fname_,', '),lname_));
END GetFullName
Compliant Code Example
procedure DeleteCloneCustomerById ( customer_Id in NUMBER ) --Compliant code
IS
BEGIN
DELETE CloneCustomer where ID = customer_Id;
COMMIT;
END DeleteCloneCustomerById
function GetFullName(fname in nvarchar2,lname in nvarchar2) return nvarchar2 --Compliant code
IS
BEGIN
RETURN(CONCAT(CONCAT(fname,', '),lname));
END GetFullName