1 – cursor-name
Specifies the name of the cursor from which you want to retrieve a row. Use a parameter if the cursor referred to by the cursor name was declared at run time with a dynamic DECLARE CURSOR statement. Specify the parameter used for the cursor name in the dynamic DECLARE CURSOR statement. You can use a parameter to refer to the cursor name only when the FETCH statement is accessing a dynamic cursor.
2 – fetch FROM
Specifies the specific segment of the list cursor to fetch. These options are available only if you specified the SCROLL option in the DECLARE CURSOR statement. The choices are: o NEXT Fetches the next segment of the list cursor. This is the default. o PRIOR Fetches the segment immediately before the current segment of the list cursor. o FIRST Fetches the first segment of the list cursor. o LAST Fetches the last segment of the list cursor. o RELATIVE simple-value-expression Fetches the segment of the list cursor indicated by the value expression. For example, relative -4 would fetch the segment that is four segments prior to the current segment. o ABSOLUTE simple-value-expression Fetches the segment of the list cursor indicated by the value expression. For example, absolute 4 would fetch the fourth segment of the list cursor.
3 – INTO
Syntax options: INTO parameter | INTO qualified-parameter | INTO variable Specifies a list of parameters, qualified parameters (host structures), or variables to receive the values SQL retrieves from the row of the cursor's result table. The number of parameters or variables in the list must be the same as the number of values in the row. (If any of the parameters is a host structure, SQL counts the number of parameters in that structure when it compares the number of host parameters in the INTO clause with the number of values in the row.) The data types of parameters and variables must be compatible with the values of the corresponding column of the cursor row.
4 – parameter
Specifies the name of the cursor from which you want to retrieve a row. Use a parameter if the cursor referred to by the cursor name was declared at run time with a dynamic DECLARE CURSOR statement. Specify the parameter used for the cursor name in the dynamic DECLARE CURSOR statement. You can use a parameter to refer to the cursor name only when the FETCH statement is accessing a dynamic cursor.
5 – simple-value-expression
Specifies either a positive or negative integer, or a numeric module language or host language parameter.
6 – USING_DESCRIPTOR
Specifies the name of a descriptor that corresponds to an SQLDA. If you use the INCLUDE statement to insert the SQLDA into your program, the descriptor name is simply SQLDA. An SQLDA is a collection of host language variables used only in dynamic SQL. In a FETCH statement, the SQLDA points to a number of parameters SQL uses to store values from the row. The number of parameters must match the number of columns in the row. The data types of parameters must be compatible with the values of the corresponding column of the cursor row.