SQL$HELP72.HLB  —  ITERATE Control, Example
    Example 1: Using the ITERATE Control Statement

    The following example shows the ITERATE control statement being
    used to prematurely complete the processing of the current row in
    a FOR cursor loop:

    SQL> BEGIN
    cont>   FOR :ord AS TABLE CURSOR ord_cursor
    cont>   AS SELECT * FROM orders WHERE customer_id = :cid
    cont>   DO
    cont>      IF stock_count (:ord.product_id, :ord.quantity) IS NULL THEN
    cont>           ITERATE;
    cont>      END IF;
    cont>      -- transfer stock to this order
    cont>      UPDATE stock SET on_hand = on_hand - :ord.quantity
    cont>       WHERE product_id = :ord.product_id;
    cont>      UPDATE orders SET :ord.available = :ord.quantity
    cont>       WHERE CURRENT OF ord_cursor;
    cont>   END FOR;
    cont> END;
Close Help