|Oracle® Database PL/SQL Language Reference
11g Release 2 (11.2)
Part Number E17126-03
The assignment statement sets the value of a data item to a valid value.
See "expression ::=".
The name of a collection variable. For information about collection variables, see "Collection Variable".
A numeric expression whose value has the data type
PLS_INTEGER or a data type that can be implicitly converted to
PLS_INTEGER (see "PLS_INTEGER and BINARY_INTEGER Data Types").
index to assign the value of
expression to a specific element of the collection variable.
index to assign
expression to the entire collection variable.
collection_variable_name is the name of an associative array, then
expression must be the name of a collection variable of the same data type.
collection_variable_name is the name of a varray or nested table, then
expression can be any of the following:
The name of a collection variable of the same data type
A collection constructor for the data type of the target collection variable (for collection constructor syntax, see "collection_constructor ::=")
Note:Collections with elements of the same type might not have the same data type. For the syntax of collection type definitions, see "Collection Variable".
The name of a cursor variable. For information about cursor variables, see "Cursor Variable Declaration".
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
The data type of a host cursor variable is compatible with the return type of any PL/SQL cursor variable.
The name of an instance of an ADT. For general information about ADTs, see "Abstract Data Types".
The name of an attribute of
The name of a formal
OUT parameter of the subprogram in which the assignment statement appears. For information about formal parameters, see "Formal Parameter Declaration".
The name of a record variable. For information about record variables, see "Record Variable Declaration".
The name of a field in
field_name to assign the value of
expression to a specific field of
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.
The name of a PL/SQL scalar variable. For information about scalar variables, see "Scalar Variable Declaration".
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. If the target is a collection variable, then the value of
expression must be a collection of the same data type (see "Assigning Values to Collection Variables"). If the target is a record variable, then the value of
expression must be a record of the same data type (see "Assigning One Record Variable to Another"). If the target has constraints, the value of
expression cannot violate them.
For general information about expressions, see "Expression".
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
The name of an indicator variable declared in a PL/SQL host environment and passed to PL/SQL as a bind argument. An indicator variable indicates the value or condition of its associated host variable (for example, in the Oracle Precompiler environment, an indicator variable can a detect null or truncated value in an output host variable). Do not put space between
host_variable_name and the colon (:) or between the colon and
indicator_name. This is correct:
In this chapter:
In other chapters: