Advantages of Subprograms
The Subprograms give extensibility; that is, tailor the PL/SQL language to suit your requirements. For illustration, if you require a procedure which creates new departments, you can easily write one, as shown below:
PROCEDURE create_dept (new_dname VARCHAR2, new_loc VARCHAR2) IS
BEGIN
INSERT INTO dept
VALUES (deptno_seq.NEXTVAL, new_dname, new_loc);
END create_dept;
The Subprograms also give modularity; that is, they break a program down into controllable, well-defined logic modules. This supports the top-down design and the stepwise refinement approach to solving a problem.
In addition, the subprograms promote reusability and maintainability. A subprogram can be used once validated with the confidence in any number of applications. When its definition changes only the subprogram is affected. These simplify the maintenance and enhancement.
At last, the subprograms aid abstraction, the mental division from particulars. To use the subprograms, you should know what they do, not how they work. And hence, you can design the applications from the top down without worrying about the implementation details. The Dummy subprograms (stubs) permit you to defer the definition of procedures and functions until you test and debug the major program.