Database Package Procedures

A package procedure is created in a database package. If you delete the database package you also delete the procedures it contains.

A package procedure has the following properties:

Property

Description

Name

The name of the item which should be clear and meaningful, and should convey the item's purpose to non-technical users.

Code

The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces.

Comment

Additional information about the package procedure.

Stereotype

Sub-classification used to extend the semantics of an object without changing its structure; it can be predefined or user-defined.

DB Package

Name of the database package to which the procedure belongs.

Type

Allows you to choose between procedure and function.

Return data type

Allows you to define the return data type of a function.

Pragma

Allows you to type a compiler directive, that is, a string for specifying compilation parameters for the procedure.

Public

Allows you to declare the procedure in the package specification and to permit use from outside the database package. A private procedure (check box deselected) is only defined in the package body.

The following tabs are also available:


  • Parameters tab – Lists the input and output parameters required by the procedure (see Database package parameters).

  • Definition tab - Lets you define package procedures. Package procedures are not built using the structure of templates defined in the DBMS. You have to type the entire package procedure definition. To do so, you can use operators and functions to insert script items into the cursor definition.

For example, the definition of the CREDIT package procedure is the following:

CREATE PROCEDURE credit (Account_number NUMBER, Amount IN NUMBER) AS
BEGIN
UPDATE accounts
SET balance = balance + amount
WHERE account_id = acc_no;
END;