Synopsis
Description
TheLOOP statement is an optional construct in SQL
routines to allow processing of a block of statements
repeatedly.
The block of statements is processed until an explicit use of LEAVE causes
processing to exit the loop. If processing reaches END LOOP, another iteration
of processing from the beginning starts. LEAVE statements are typically
wrapped in an IF statement that declares a condition to stop the loop.
The optional label before the LOOP keyword can be used to name the
block.
Examples
The following function counts up to100 in a loop starting from the input
value i and returns the number of incremental steps in the loop to get to
100.
LOOP statement
in combination with other statements are available in the SQL routines examples
documentation.