In Packages
The Forward declarations also group logically related subprograms in the package. The subprogram specifications go in the package specification, & the subprogram bodies go into the package body, wherever they are invisible to applications. And for this reason, the packages permit you to hide the implementation details. The illustration is as shown below:
CREATE PACKAGE emp_actions AS -- package spec
PROCEDURE hire_employee (emp_id INTGER, name VARCHAR2, ...);
PROCEDURE fire_employee (emp_id INTEGER);
PROCEDURE raise_salary (emp_id INTEGER, amount REAL);
...
END emp_actions;
CREATE PACKAGE BODY emp_actions AS -- package body
PROCEDURE hire_employee (emp_id INTGER, name VARCHAR2, ...) IS
BEGIN
...
INSERT INTO emp VALUES (empno, ename, ...);
END hire_employee;
PROCEDURE fire_employee (emp_id INTEGER) IS
BEGIN
DELETE FROM emp
WHERE empno = emp_id;
END fire_employee;
PROCEDURE raise_salary (emp_id INTEGER, amount REAL) IS
salary REAL;
BEGIN
SELECT sal INTO salary FROM emp
WHERE empno = emp_id;
...
END raise_salary;
...
END emp_actions;
You can define subprograms in the package body without declaring their specifications in the package specification. Though, such subprograms can be called only from inside the package.