4-14. Executing Package Programs in Sequence

Problem

You have created a package that contains all the necessary procedures and functions for your program. Although you can invoke each of these subprograms individually using the package_name.subprogram_name notation, it would be beneficial to execute all of them at the same time by issuing a single statement.

Solution

Create a driver procedure within your PL/SQL package that will be used to initiate all the subprograms in turn, and run your entire program. In the following example, a procedure named driver is created inside a package, and it will invoke all the other package subprograms in turn:

First, create the specification:

CREATE OR REPLACE PACKAGE synchronize_data IS   PROCEDURE driver; ...

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.