Home
Cursor parameters should follow a naming convention
Description
The Pl_Sql code rule "Cursor parameters should follow a naming convention" states that all cursor parameters should be named in a consistent manner. This helps to ensure that the code is easier to read and understand. For example, all cursor parameters should be prefixed with "cur_" to indicate that they are cursor parameters. This helps to differentiate them from other variables and makes the code more readable. Additionally, all cursor parameters should be named in a consistent manner, such as using camelCase or underscores. This helps to make the code more organized and easier to read. Following this rule will help to ensure that the code is more maintainable and easier to debug.
Key Benefits
- Ensure Consistency and Readability: Cursor parameters should follow a naming convention rule to ensure consistency and readability.
- Organization: A naming convention rule helps to organize and structure the code, making it easier to read and understand.
- Efficiency: Following a naming convention rule can help to reduce the time spent debugging and troubleshooting code.
- Documentation: A naming convention rule can help to document the code, making it easier for other developers to understand.
Non-compliant Code Example
DECLARE
CURSOR deptCursor_ (departmentId_ INTEGER) RETURN departments%ROWTYPE IS --Non compliant code (Cursor parameters is not following a naming convention)
SELECT * FROM departments
WHERE department_id = departmentId_;
BEGIN
NULL;
END;
Compliant Code Example
DECLARE
CURSOR deptCursor (departmentId INTEGER) RETURN departments%ROWTYPE IS --Compliant code (Cursor parameters is following a naming convention)
SELECT * FROM departments
WHERE department_id = departmentId;
BEGIN
NULL;
END;