Home
Package names should comply with a naming convention
Description
The rule "Package names should comply with a naming convention" states that when creating a package in PL/SQL, the package name should adhere to a specific naming convention. This naming convention should be consistent and easy to understand, and should be used for all packages created in the database. The naming convention should also be documented and shared with all developers who will be using the package. This will ensure that all packages are easily identifiable and that their purpose is clear. Additionally, it will help to prevent confusion and reduce the risk of errors.
Key Benefits
- Organization: Package names should comply with a naming convention rule to ensure organization and consistency across projects.
- Ease of Use: Following a naming convention makes it easier to find and use packages since they are named in a predictable way.
- Ease of Maintenance: Following a naming convention makes it easier to maintain packages since they are named in a predictable way.
Non-compliant Code Example
CREATE OR REPLACE PACKAGE BODY CUSTOMER_PACKAGE_ --Non compliant code (Package names is not compliant with the naming convention)
AS
function GetCompleteCustomerDetails(customerId In INTEGER)
return CUSTOMER_T
Is
BEGIN
Select FIRSTNAME, LASTNAME, AREA, CITY Into CUSTOMER_T.FirstName, CUSTOMER_T.LastName, CUSTOMER_T.Area, CUSTOMER_T.City FROM CUSTOMERS Where Id = customerId;
RETURN CUSTOMER_T;
END GetCompleteCustomerDetails;
END CUSTOMER_PACKAGE_
Compliant Code Example
CREATE OR REPLACE PACKAGE BODY CUSTOMER_PACKAGE --Compliant code (Package names is compliant with the naming convention)
AS
function GetCompleteCustomerDetails(customerId In INTEGER)
return CUSTOMER_T
Is
BEGIN
Select FIRSTNAME, LASTNAME, AREA, CITY Into CUSTOMER_T.FirstName, CUSTOMER_T.LastName, CUSTOMER_T.Area, CUSTOMER_T.City FROM CUSTOMERS Where Id = customerId;
RETURN CUSTOMER_T;
END GetCompleteCustomerDetails;
END CUSTOMER_PACKAGE