Packages

From DBArtisan
Jump to: navigation, search

Go Up to Supported Objects

Note: This object is supported by IBM DB2 for Linux, Unix, and Windows, IBM DB2 for OS/390 and z/OS, and Oracle only.

Packages contain all the information needed to process SQL statements from a single source file. You can use packages to process and call batches of SQL. Depending on the platform, packages can include:

  • Procedures
  • Functions
  • Types
  • Variables
  • Constants
  • Exceptions
  • Cursors
  • Subprograms

Packages offer a number of important advantages over using standalone procedures and functions, including the ability to:

  • Modify package objects without recompiling dependent database objects.
  • Declare global variables and cursors that can be shared within the package.
  • Grant privileges more efficiently.
  • Load multiple package objects into memory at once.

Packages usually have two parts: a header or specification and a body, although sometimes the body is unnecessary. The package header declares the members of the package while the body details the logic underlying each of the package components.

Note: The Datasource Navigator/Explorer splits out package headers and package bodies; however, you create both a package header and body from the packages node.

Creating and editing

DBMS platform availability and object actions/operations supported

The following table lists object actions available for this object type. For an introduction to object actions and details on usage of specific actions, see Object actions.

DB2 LUW DB2 z/OS ORCL

Bind Package

Compile

Create Synonym

Drop

Extract

Flush Cache

Free (Packages)

Migrate

Rebind Packages

Report