G-7120 Always add the name of the program unit to its end keyword.
Minor
Maintainability
Reason
It's a good alternative for comments to indicate the end of program units, especially if they are lengthy or nested.
Example (bad)
CREATE OR REPLACE PACKAGE BODY employee_api IS
FUNCTION employee_by_id (in_employee_id IN employees.employee_id%TYPE)
RETURN employees%rowtype IS
r_employee employees%rowtype;
BEGIN
SELECT *
INTO r_employee
FROM employees
WHERE employee_id = in_employee_id;
RETURN r_employee;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN TOO_MANY_ROWS THEN
RAISE;
END;
END;
/
Example (good)
CREATE OR REPLACE PACKAGE BODY employee_api IS
FUNCTION employee_by_id (in_employee_id IN employees.employee_id%TYPE)
RETURN employees%rowtype IS
r_employee employees%rowtype;
BEGIN
SELECT *
INTO r_employee
FROM employees
WHERE employee_id = in_employee_id;
RETURN r_employee;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN TOO_MANY_ROWS THEN
RAISE;
END employee_by_id;
END employee_api;
/