Database Package Variables

Variables can be declared within a package, and can be used in a SQL or PL/SQL statement to capture or provide a value when one is needed. For example, you can define the variable in_stock with a boolean data type to verify if a product is available or not. You create database package variables on the Variables tab of a database package using the Add a Row tool.

To view or edit a database package variable's properties, double-click its Browser or list entry. The property sheet tabs and fields listed here are those available by default, before any customization of the interface by you or an administrator.

The General tab contains the following properties:

Property

Description

Name/Code/Comment

Identify the object. The name should clearly convey the object's purpose to non-technical users, while the code, which is used for generating code or scripts, may be abbreviated, and should not normally include spaces. You can optionally add a comment to provide more detailed information about the object. By default the code is generated from the name by applying the naming conventions specified in the model options. To decouple name-code synchronization, click to release the = button to the right of the Code field.

DB Package

Name of the database package to which the variable belongs.

Data Type

Data type of the variable. You can use the Question Mark button to display the list of Standard Data Types.

Mandatory

If selected, indicates that the not null clause is set on the variable, thus making it mandatory.

Length

Allows you to define the variable length.

Precision

Number of places after the decimal point, for data values that can take a decimal point.

Default value

Default value of the variable.

Constant

Indicates that the variable is a constant. A constant has a value assigned. For example: Credit_Limit constant REAL := 500 000;

Public

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

Keywords

Provide a way of loosely grouping objects through tagging. To enter multiple keywords, separate them with commas.