15.10 - Labels - Teradata Database

Teradata Database SQL Stored Procedures and Embedded SQL

prodname
Teradata Database
vrm_release
15.10
category
Programming Reference
featnum
B035-1148-151K

You can use a label with iteration statements (FOR, LOOP, REPEAT and WHILE) and BEGIN … END compound statements in a stored procedure. The following rules apply:

  • A beginning label must be terminated by a colon character (:).
  • An ending label is not mandatory for an iteration statement or compound statement.
  • If an ending label is specified, it must have a corresponding beginning label associated with that iteration or BEGIN … END statement. For example, an ending label following an END WHILE must have an equivalent beginning label and colon character preceding the corresponding WHILE.

  • The scope of a label is the iteration statement or BEGIN … END compound statement with which it is associated.
  • This implies that if another iteration statement or compound statement is nested, the label name associated with the outer iteration or compound statement must not be used with any inner iteration statement(s) or compound statement(s).