3. Statements : OpenROAD SQL Statements : Select Statement : Using a Select Loop
 
Share this page                  
Using a Select Loop
A select loop is one or more operations that the program performs on each row of values returned by a select statement. Because select loops provide better performance than cursors, you should use select loops whenever the operations that you want to perform on the returned rows are completed within a single event block.
The begin and end keywords define the statement block that is the select loop. You can use any legal 4GL statement in the statement list.
The system variable IIrowcount has an undefined value during the execution of a select loop unless you execute a query statement as part of the loop. In such cases, the value of IIrowcount is defined for that statement. After the select loop completes, the value in IIrowcount reflects the number of rows processed by the loop.
For more information about using select loops and cursors, see the Programming Guide.