Skip Headers
Oracle® Database PL/SQL Language Reference
11g Release 2 (11.2)

Part Number E10472-05
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Record

A record variable is a composite variable whose internal components, called fields, can be of different data types. You access each field with this syntax: record_name.field_name. A record variable can hold a table row, or some columns from a table row. Each field corresponds to a table column.

To create a record variable, you first define a record type, and then declare a variable of that type.

Topics:

Syntax

record_type_definition ::=

record_type_definition
Description of the illustration record_type_definition.gif

field_declaration ::=

record_field_declaration
Description of the illustration field_declaration.gif

See:

record_variable_declaration ::=

record_type_declaration
Description of the illustration record_type_declaration.gif

Semantics

record_type_definition

type_name

The name of the record type that you are defining.

field_declaration

field_name

The name of the field that you are declaring.

datatype

The data type of the field that you are declaring.

NOT NULL

Prevents the program from assigning the value NULL to the field.

PL/SQL subtypes NATURALN, POSITIVEN, and SIMPLE_INTEGER are predefined as NOT NULL. When declaring a field of one of these subtypes, you can omit NOT NULL.

If you declare a NOT NULL field, either by specifying NOT NULL or by specifying a subtype that is predefined as NOT NULL, you must also specify an initial value for the field (see expression).

expression

An expression whose value has a data type compatible with datatype (see Table 3-10, "Possible Implicit PL/SQL Data Type Conversions"). When record_variable_declaration is elaborated, the value of expression is assigned to record_name.field_name. This value is the initial value of the field.

record_variable_declaration

record_name

The name of the record variable that you are declaring.

type_name

The type of the record variable that you are declaring (the record type that you defined previously).

Examples

Related Topics

In this chapter:

In other chapters: