Creating PL/SQL packages

You can create a PL/SQL package in a data development project from the Data Project Explorer. You can also create a package from the Administration Explorer or the Data Source Explorer.

Before you begin

Ensure the following are created:
  • A connection to a database that supports PL/SQL.
  • A data development project if you create a PL/SQL package from the Data Project Explorer.

Procedure

To create a PL/SQL package:

  1. Open the explorer and navigate to the PL/SQL Packages folder.
    • From the Data Project Explorer, open the data development project. The project contains a PL/SQL packages folder.
    • From the Data Source Explorer, go to the Schemas folder for the database. Each schema folder contains a PL/SQL Packages folder.
    • From the Administration Explorer, open the Application Objects folder for the database. The folder contains a PL/SQL Packages folder.
  2. Right-click the PL/SQL packages folder to create a PL/SQL package. The New PL/SQL package wizard opens.
  3. Complete the steps of the wizard.

    After you specify a name, select a template to use as the starting point for your package. Some templates are included with the product, or you can create your own templates to share with other team members using the Routines > Templates Preferences page.

  4. Click Finish. The Routine Editor opens, and displays the Specification and Body pages.

    A package specification establishes which package objects can be referenced from outside of the package; it specifies routines and declares exceptions. A package body contains the implementation of all of the procedures and functions that are declared within the package specification.

Results

If you created the package from the Data Project Explorer, the new package is listed in the PL/SQL packages folder of the project.

If you created the package from Administration Explorer or the Data Source Explorer, you can save the routine as file on your computer.

Tip: By default, creating the package does not register it on the database. To register the PL/SQL package on the database, you must deploy it.

What to do next

Modify the package and deploy it to the database. Then you can run and debug the package.

If you saved the PL/SQL package as a file on your computer, you can open it from the workbench. Open the file by selecting File > Open File. When you open the package file, you specify database connection information. The connection that you select is used when you deploy and run the package.


Feedback