The value to be assigned to each variable can be specified immediately following the variable, for example, variable = expression, variable = expression. Or, sets of parentheses can be used to specify all the variables and then all the values, for example, (variable, variable) = (expression, expression).
The data type of each variable must be compatible with its corresponding result column. Each assignment is made according to the rules described in Assignments and comparisons. The number of variables specified to the left of the equal operator must equal the number of values in the corresponding result specified to the right of the equal operator. If the value is null, an indicator variable must be provided. If an assignment error occurs, the value is not assigned to the variable, and no more values are assigned to variables. Any values that have already been assigned to variables remain assigned.
If an error occurs as the result of an arithmetic expression in the expression or SELECT list of the subselect (division by zero, or overflow) or a character conversion error occurs, the result is the null value. As in any other case of a null value, an indicator variable must be provided. The value of the variable is undefined. In this case, however, the indicator variable is set to -2. Processing of the statement continues as if the error had not occurred. (However, a warning is returned.) If you do not provide an indicator variable, an error is returned. It is possible that some values have already been assigned to variables and will remain assigned when the error occurs.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.