Specify the name of a cursor that is defined in a DECLARE CURSOR statement of your program. The DECLARE CURSOR statement must precede the FETCH statement in your source program. When the FETCH statement is executed, the cursor must be in the open state.
If INTO is used, each host-variable you specify must identify a variable that is described in your program in accordance with the rules for declaring host variables. The host variables must be separated by commas.
The first value in the result row is assigned to the first variable in the list, the second value to the second variable, and so on. If the number of variables is not the same as the number of values in the row, the SQLCA-WARNING(4) field of the SQLCA is set to W.
The data type of a variable must be compatible with the value assigned to it. If the value is numeric, the variable must have the capacity to represent the integral part of the value. If the value is null, an indicator variable must be specified.
Each assignment to a variable is made according to the rules described in Basic Operations (Assignment and Comparison) Assignments are made in sequence through the list. 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.
This clause allows the row of a result table of a cursor to be fetched into variables which are determined at execution-time. Descriptor-name identifies a SQL Descriptor Area (SQLDA) that contains a valid description of zero or more host variables. The length of the SQLDA, as indicated by SQLABC, must be sufficient to describe the number of variables indicated by SQLD. The first value of a row corresponds to the first variable described by the SQLDA, the second value to the second variable, and so on. For more information about the SQLDA, see SQL Descriptor Area (SQLDA).
|
Copyright © 2014 CA.
All rights reserved.
|
|