13.3 Assignment Statement
The assignment statement sets the value of a data item to a valid value.
Expression whose value is to be assigned to
assignment_statement_target must have compatible data types.
Collections with elements of the same type might not have the same data type. For the syntax of collection type definitions, see "Collection Variable Declaration".
Data item to which the value of
expression is to be assigned.
Name of a collection variable.
Index of an element of
index, the entire collection variable is the assignment statement target.
index must be a numeric expression whose data type either is
PLS_INTEGER or can be implicitly converted to
PLS_INTEGER (for information about the latter, see "Predefined PLS_INTEGER Subtypes").
Name of a cursor variable.
Name of a cursor variable declared in a PL/SQL host environment and passed to PL/SQL as a bind variable. 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.
Name of an instance of an abstract data type (ADT).
Name of an attribute of
attribute, the entire ADT is the assignment statement target.
Name of a formal
OUT parameter of the subprogram in which the assignment statement appears.
Name of a record variable.
Name of a field of
field, the entire record variable is the assignment statement target.
Name of a PL/SQL scalar variable.
Name of a variable declared in a PL/SQL host environment and passed to PL/SQL as a bind variable. Do not put space between the colon (:) and
Name of an indicator variable declared in a PL/SQL host environment and passed to PL/SQL as a bind variable. (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 and the colon (:) or between the colon and
indicator_variable. This is correct:
Example 2-24, "Assigning Values to Variables with Assignment Statement"
Example 2-27, "Assigning Value to BOOLEAN Variable"
Example 5-10, "Data Type Compatibility for Collection Assignment"
In this chapter:
In other chapters: