Skip to main content

1E 23.7 (SaaS)

FOREACH IN DO DONE

Keywords

FOREACH IN DO DONE

Purpose

Allows you to repeat a block of one or more statements for each row in a @table, and optionally save in a @table the output of the last statement in the block.

Description

Syntax

FOREACH @newTable IN @existingTable
DO
   //block of statements using @newTable (SELECT statements, Methods and/or Functions)
   //optional 'early exit' termination
DONE;

FOREACH does not have any conditional flow control (eg. WHILE or BREAK) but this may change in a future version of Tachyon. However, you can cause the instruction to terminate early using EVALUATE, RETURN, NOCONTENT, ERROR, and NOTIMPLEMENTED..

Examples

See SCALE User Guide: Looping with FOREACH.

Notes

SeeSCALE User Guide: Inconsistent branching results.