Package Body

Package body is the initialization part of the package. It defines the queries for cursors and the code for subprograms included into the package. Procedure implementation details and private declarations are encapsulated in the package body and they are hidden from code outside the package.

Note

Sometimes package body is unnecessary.

Note

Subprograms defined in a package body are accessible outside the package only if their declarations are also present in the package specification. If a subprogram declaration is not included into the package specification, that subprogram can be called only by other subprograms in the same package.

PL/SQL allows two or more packaged subprograms to have the same name. This option is useful when you want a subprogram to accept similar sets of parameters that have different data types.

Creating a Package Body

  1. In the Database Explorer window, expand the Packages folder.
  2. Right click a required package, and then click Create Package Body.
  3. Fill a template with statements. dbForge Studio adds the CREATE/REPLACE words for you.
  4. Save the document.

Editing a Package Body

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