-779   LABEL label SPECIFIED ON A GOTO, ITERATE, OR LEAVE STATEMENT IS NOT VALID

Explanation

Label label is specified as the target label for a GOTO, ITERATE or LEAVE statement. label is not defined, is not defined in a scope that is accessible to the current statement, or to the current statement, or it is not a valid label for the failing statement.

This error can occur with a GOTO, ITERATE or LEAVE statement for one of the following reasons:
  • If the failing statement is in a condition handler, then label must be defined in that condition handler.
  • If the failing statement is not in a condition handler, then label must not be defined in a condition handler.
Additionally, this error can be issued for ITERATE or LEAVE statements for one of the following reasons:
  • If the failing statement is an ITERATE statement, then label must be defined as a label for a FOR, LOOP, REPEAT, or WHILE statement, and the ITERATE statement must be in that FOR, LOOP, REPEAT, or WHILE statement, or in a block of code that is directly or indirectly nested within that statement.
  • If the failing statement is a LEAVE statement, then label must be defined as a label for a compound, FOR, LOOP, REPEAT, or WHILE statement, and the LEAVE statement must be in that compound, FOR, LOOP, REPEAT, or WHILE statement, or in a block of code that is directly or indirectly nested within that statement.

System action

The statement cannot be processed.

User response

Specify a valid label for the target of the GOTO, ITERATE, or LEAVE statement.

SQLSTATE

42736