Package Specification

Last modified: October 23, 2019

The specification is the package interface. It consists of declarations of types, variables, constants, exceptions, cursors, and subprograms that can be referenced from outside the package. The specification holds public declarations, which are visible outside the package. You must declare subprograms at the end of the specification after all other items (except pragmas that name a specific function; such pragmas must follow the function specification). If specification declares only types, constants, variables and exceptions the package body is unnecessary. Only subprograms and cursors have an underlying implementation.

Creating a Package Specification

  1. In the Database Explorer window, right-click the Packages folder, and then click New Package. A new template document appears.
  2. Fill a template with statements. dbForge Studio adds the CREATE/REPLACE words for you.
  3. Save the document.

Editing a Package Specification

  1. In the Database Explorer window, expand the Packages folder.
  2. Right-click a required package, and then click Open Package, to open its specification.

Executing a Stored Procedure within a Package

  1. In the Database Explorer window, expand the Packages folder.
  2. Expand a required package.
  3. Select a required procedure, and then click Execute.

If a procedure accepts parameters you will see the Parameters dialog box where you can assign initial values for procedure arguments. Once the routine is executed you will see appropriate record in the Output window.

If a package is invalid you have to compile it to make it work. To do this, choose Compile on the package’s shortcut menu. The whole package is considered invalid if at least one procedure or function that make up its body is invalid. Read more about the matter in the Working with Procedures and Functions topic.