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

Part Number E10472-02
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

Assignment Statement

The assignment statement sets the value of a variable, field, parameter, or element.

Topics:

Syntax

assignment_statement ::=

assignment_statement
Description of the illustration assignment_statement.gif

See expression ::=.

Semantics

attribute_name

The name of an attribute of object_name.

collection_name

The name of a collection. For information about collections, see "Collection".

cursor_variable_name

The name of a cursor variable. For information about cursor variables, see "Cursor Variable".

expression

The expression whose value is to be assigned to the target (the item to the left of the assignment operator) when the assignment statement runs.

The value of expression must have a data type that is compatible with the data type of the target (see "PL/SQL Data Type Conversion").

If the target is a variable defined as NOT NULL, the value of expression cannot be NULL. If the target is a cursor variable, the value of expression must also be a cursor variable.

For general information about expressions, see "Expression".

field_name

The name of a field in record_name.

Specify field_name to assign the value of expression to a specific field of record_name.

Omit field_name to assign the value of expression to all fields of record_name simultaneously; that is, to assign one record to another. You can assign one record to another only if their declarations refer to the same table or cursor.

host_cursor_variable_name

The name of a cursor variable declared in a PL/SQL host environment and passed to PL/SQL as a bind argument. Do not put space between the colon (:) and host_cursor_variable_name.

The data type of a host cursor variable is compatible with the return type of any PL/SQL cursor variable.

host_variable_name

The name of a variable declared in a PL/SQL host environment and passed to PL/SQL as a bind argument. Do not put space between the colon (:) and host_variable_name.

index

A numeric expression whose value has the data type PLS_INTEGER or a data type that can be implicitly converted to PLS_INTEGER (see Table 3-10, "Possible Implicit PL/SQL Data Type Conversions").

Specify index to assign the value of expression to a specific element of collection_name.

Omit index to assign the value of expression to all elements of collection_name simultaneously; that is, to assign one collection to another. You can assign one collection to another only if the collections have the same data type (not the same element type).

indicator_name

The name of an indicator variable for host_variable_name.

An indicator variable indicates the value or condition of its host variable. For example, in the Oracle Precompiler environment, indicator variables let you detect NULL or truncated values in output host variables.

object_name

The name of an instance of an ADT. For general information about ADTs, see "Abstract Data Types".

parameter_name

The name of a formal OUT or IN OUT parameter of the subprogram in which the assignment statement appears. For information about formal parameters, see "Parameter".

record_name

The name of a record. For information about records, see "Record".

variable_name

The name of a PL/SQL variable. For information about variables, see "Variable".

Examples

Related Topics

In this chapter:

In other chapters: