Oracle® HTML DB
Release 2.0
  Go To Table Of Contents
Contents

Previous
Previous
Next
Next
 

Managing Packages

A package is a database object that groups logically related PL/SQL types, items, functions and procedures. Packages usually have two parts, a specification and a body. The specification is the interface to your application. The body implements the specification.

Topics:


See Also:

SQL*Plus User's Guide and Reference for information about PL/SQL packages

Creating a Package

To create a package:

  1. Navigate to Object Browser:

    1. Click the SQL Workshop icon on the Workspace home page.

    2. Click Object Browser.

      Object Browser appears.

  2. Click Create.

  3. From the list of object types, select Package.

  4. Select the type of package you want to create:

    • Specification

    • Body

    • Package with methods on database tables

  5. If you select Specification:

    1. Enter a name and click Next.

      The wizard creates a dummy package specification and displays it for editing.

    2. Edit the specification and click Finish.

  6. If you select Body:

    1. Select the package you want to create the body for and click Next

      The wizard creates a package body with stubbed out calls identified in the specification and displays it for editing.

    2. Edit the package body and click Finish.

  7. If you select Package with methods on database tables:

    1. Enter a name and click Next.

    2. Select up to ten tables and click Next.

      The wizard creates a specification and body with insert, update, delete, and GET APIs for the selected tables. Note that you have the option to show or download the specification or body.

    3. Click Finish.

Viewing a Package

When you access a package in Object Browser the specification appears.

To view a specification:

  1. Navigate to Object Browser:

    1. Click the SQL Workshop icon on the Workspace home page.

    2. Click Object Browser.

      Object Browser appears.

  2. From the Object list, select Packages.

  3. From the Object Selection pane, select a package.

    The Specification appears. You can copy the code in this view for use in other tools.

Summary of Available Views

Click the tabs at the top of the page to view different reports about the package. Table 18-7 describes all available views.

Table 18-7 Available Views for Packages

View Description

Specification

(Default) Displays the package specification. This define the interface to your application. Actions you can perform include:

  • Edit

  • Compile

  • Download

  • Drop

  • Find

Body

Displays the package body, if one exists, for the selected package. Actions you can perform include:

  • Edit

  • Compile

  • Download

  • Drop

  • Find

Dependencies

Displays objects that use (or depend on) on the current package and objects the package depends on.

Errors

Displays errors related to the current package.

Grants

Lists details of grants for the current package, including privilege, grantee, grantable, grantor, and object name.


Editing a Package

When you edit a package, you can edit the code manually, perform a search and replace, and compile the package.

Editing a Package Manually

To edit a package manually:

  1. Navigate to Object Browser:

    1. Click the SQL Workshop icon on the Workspace home page.

    2. Click Object Browser.

      Object Browser appears.

  2. From the Object list, select Packages.

  3. From the Object Selection pane, select a package.

    The Specification appears. You can copy the code in this view for use in other tools. Note you can edit both the specification and the body fromObject Browser.

  4. Click Edit to activate edit mode.

  5. Click Find to perform a basic search and replace.


Note:

You can expand the Edit pane by clicking the Full Screen icon in the upper right of the pane, beneath the Create button.

Compiling a Package

If you edit and make changes to a package, you need to compile in order to save your changes. There is no save function because this is just a view of the object within the database.

Click Compile to compile the current package. Compiling re-creates the object in the database. If the compile fails, an error message display above the code.

Downloading a Package

Click Download to save the current package as a file.

Dropping a Package

Click Drop to delete the current package.