@ryan.murray
To use loops in Teradata, you can make use of the REPEAT, WHILE, and FOR loops.
1 2 3 4 5 6 |
SET i = 1; REPEAT ... SET i = i + 1; UNTIL i > 10 END REPEAT; |
1 2 3 4 5 |
SET i = 1; WHILE i <= 10 DO ... SET i = i + 1; END WHILE; |
1 2 3 |
FOR i AS 1 TO 10 DO ... END FOR; |
These loops can be used within a Teradata stored procedure, function, or block of SQL code to iterate over a set of statements until a certain condition is met.