#WHILE operator

[ Home / SQLBatch Home / Documentation / Basics ]


SYNTAX

{#while bool expression }
  SQL block 	
{#end}

DESCRIPTION

#WHILE operator executes the SQL block while the expression is TRUE.

PARAMETERS

bool expression Any SB expression. If the expression evaluates to an empty string or zero or non-existent variable then it's considered to be a FALSE value otherwise it's a TRUE value.
SQL block Any SQL command or sequence of commands or part of a command. It may contain nested #while or other operators.

EXAMPLE 1

{count = 5;}
{#while count}
	prompt {count--}
{#end}

The result is:
5
4
3
2
1

EXAMPLE 2

{count = 5;}
prompt {#while count} {count--} {#end}

The result is:
 5  4  3  2  1

See Also
Language Basics
#FOR operator
#IF operator
Variables
Special Variables


Copyright (C) 1999 - 2024 Anatoly Moskovsky Report a site problem