Description

label
Specifies the label for the FOR statement. If the ending label is specified, it must be the same as the beginning label. The label name cannot be the same as the routine name or another label within the same scope. For more information, see Handling errors and warnings.
SQL-variable-name
The SQL-variable-name can be used to qualify variables in the statement. The SQL-variable-name must not be the same as any label within the same scope. For more information, see Handling errors and warnings.

Either the SQL-variable-name or label can be used to qualify other SQL variable names in the statement.

If SQL-variable-name is specified, then it should be used to qualify any other SQL variable names in the statement when debugging the SQL function, SQL procedure, or SQL trigger.

cursor-name
Names a cursor. If not specified, a unique cursor name is generated.
WITH HOLD
Prevents the cursor from being closed as a consequence of a commit operation. A cursor declared using the WITH HOLD clause is implicitly closed at commit time only if the connection associated with the cursor is ended during the commit operation. For more information, see DECLARE CURSOR.
select-statement
Specifies the select statement of the cursor.

Each expression in the select list must have a name. If an expression is not a simple column name, the AS clause must be used to name the expression. If the AS clause is specified, that name is used for the variable and must be unique.

SQL-procedure-statement
Specifies the SQL statements to be executed for each row of the table. The SQL statements should not include an OPEN, FETCH, or CLOSE specifying the cursor name of the FOR statement.