Allows SQL statements to be repeated.
WHILE condition statement
condition
An SQL Search Condition.
statement
A supported SQL statement, or a group of statements enclosed in the
BEGIN and END
keywords.
While condition evaluates to true, the WHILE statement executes statement repeatedly.
SET @I = 0 SET @V1 = SECOND(CURTIME())+1 WHILE @I<10 BEGIN SET @I = @I+1 SET @V2 = @V1*@I + @V1/@I INSERT INTO TESTDATA VALUES(@I,@V2) END
Loops, executing the block of three statements for each value of variable @I. The loop terminates when @I becomes equal to 10.