Variable "<str>" is a FOR loop counter - assignment not allowed Explanation: The named variable was used by the FOR counted loop which makes it a CONSTANT for the duration of the loop body. This variable is the target of a SET, INSERT...RETURNING, SELECT...INTO, UPDATE...RETURNING, or GET GIAGNOSTICS statement or CALL output parameter. User Action: Check that the correct variable is used in this statement. If you need to update the loop counter, replace the FOR IN loop with a WHILE loop.