Database Package Types

A type is a user-defined composite datatype that encapsulates a data structure along with the functions and procedures needed to manipulate the data. You can also define subtypes of object types: a subtype contains all the attributes and methods of the parent type, it can contain additional attributes and can override methods from the type.

Types have 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 type.

DB Package

Name of the database package to which the type belongs.

Type

Allows you to declare the type as type or subtype.

Public

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

The following tabs are also available:


  • Definition - Used to declare the type contents.

The following example defines the type bank_account:

CREATE TYPE Bank_Account AS OBJECT (
acct_number INTEGER(5),
balance REAL,
status VARCHAR2(10),
);