FOR Syntax Elements - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
vqj1592443206677.ditamap
dita:ditavalPath
vqj1592443206677.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantageā„¢
IF_statement
See IF.
CASE_statement
See CASE.
label_name
An optional label for the FOR statement.
If an ending-label is specified, you must specify a beginning-label that is equivalent to the ending-label. The beginning-label must be terminated by a colon character (:).
The label name of the BEGIN END compound statement cannot be reused in an iteration statement. One label name cannot be reused within one group of nested FOR statements, but can be reused for different non-nesting iteration statements.
for_loop_variable
The name of the loop.
cursor_name
The name of the cursor.
Used for updatable cursors as the object of the WHERE CURRENT OF clause.
cursor_specification
A single SELECT statement used as the cursor.
In read-only cursors, the single SELECT statement can contain one SELECT or multiple SELECTs that use set operators like UNION, INTERSECT or MINUS.
Updatable cursors do not support the set operators.
statement
One or more DML, DDL, DCL statements, including dynamic SQL statements, or control statements, including BEGIN END compound statements.