DB2 Version 10.1 for Linux, UNIX, and Windows

Records (PL/SQL)

A record type is a composite data type that consists of one or more identifiers and their corresponding data types.

You can create user-defined record types by using the TYPE IS RECORD statement within a package or by using the CREATE TYPE (Object) statement.

Dot notation is used to reference fields in a record. For example, record.field.

Syntax

Read syntax diagramSkip visual syntax diagram
                                .-,---------------.      
                                V                 |      
>>-TYPE--rectype--IS RECORD--(----field--datatype-+--)---------><

Description

TYPE rectype IS RECORD
Specifies an identifier for the record type.
field
Specifies an identifier for a field of the record type.
datatype
Specifies the corresponding data type of the field. The %TYPE attribute, RECORD, VARRAY, associative array types, and the %ROWTYPE attributes are supported.

Example

The following example shows a package that references a user-defined record type:
CREATE OR REPLACE PACKAGE pkg7a
IS
TYPE t1_typ IS RECORD (
  c1 T1.C1%TYPE,
  c2 VARCHAR(10)
);
END;