DB2 Version 9.7 for Linux, UNIX, and Windows

Looping statements in SQL procedures

Looping statements provide support for repeatedly executing some logic until a condition is met. The following looping statements are supported in SQL PL:

The FOR statement is distinct from the others, because it is used to iterate over rows of a defined result set, whereas the others are using for iterating over a series of SQL statements until for each a condition is satisfied.

Labels can be defined for all loop-control-statements to identify them.