Share
 
 

Control Logic

You can include the following control logic in the SQL queries

WHILE loops

If.. elseif.. else... endif blocks

The syntax of while loops is as follows

WHILE expression;

<statements>

WEND

The syntax of IF statements is as follows

IF expression

<statements>

optionally one or more blocks

ELSEIF expression

<statements>

optionally

ELSE

<statements>

ENDIF

For fans of the wildly varying world of programming languages note that ELSEIF and ENDIF are both one word.

It is possible to break out of loops by using the BREAK keyword e.g.

IF $x>0 AND $y>0

BREAK

ENDIF

this breaks out of the loop which immediately contains the BREAK keyword.

If the SQL contains a WHILE loop then a progress bar appears and you can break into the query. Obviously the progress bar does not actually progress, since it cannot work out how far into the running of the query you are.

Was this information helpful?