Previous Topic: ITERATE StatementNext Topic: LEAVE Statement


Example

An ITERATE statement example follows. This example skips rows we are not interested in. In the example that follows, logic that is not shown (for space considerations) is indicated by three vertically arranged periods.

    .
    .
    .
 startWhile:
    WHILE sqlStateLocal <-> '00000' DO
       FETCH orderCrs INTO orderId, custId, creditReqAmt;
       .
       .
       .
       IF creditReqAmt = 0 THEN
          ITERATE startWhile;
       END IF;
       .
       .
       .
    END WHILE endWhile DATACOM LOOPLIMIT 10000;
    .
    .
    .