Control-of-flow

Control-of-flow#

Control-of-flow language controls the order in which statements run within a batch. Querona supports the BEGIN...END block together with the IF...ELSE and WHILE constructs.

BEGIN…END#

Groups a series of statements into a single block so that they are treated as a unit.

BEGIN
    { statement | statement_block }
END

IF…ELSE#

Runs a statement, or block, conditionally.

IF boolean_expression
    { statement | statement_block }
[ ELSE
    { statement | statement_block } ]
IF (SELECT COUNT(*) FROM dbo.orders) > 0
    SELECT 'has orders';
ELSE
    SELECT 'no orders';

WHILE#

Repeats a statement, or block, while a condition remains true.

WHILE boolean_expression
    { statement | statement_block }

Note

For error handling, note that TRY...CATCH, THROW and RAISERROR are not currently supported. See Feature support.