RDOHELP72.HLB  —  FOR  More
    You need the Oracle Rdb READ privilege to the records in a record
    stream to use the FOR statement.

    You can nest FOR loops as an alternative to the CROSS clause to
    perform a join operation. However, the performance of the CROSS
    clause is usually faster.

    However, the interactive RDO utility unbundles loops when an inner
    loop does not reference the context of an outer loop, such as that
    shown in  the following example:

    FOR F1 IN F1 WITH F1.F11 = "1"
        PRINT F1.*
        FOR F2 IN F2 WITH F2.F21 = "1"
            PRINT F2.*
            ERASE F2
        END_FOR
        ERASE F1
    END_FOR

    This loop will be executed as two discrete loops because RDO considers
    them independent.

    FOR F1 IN F1 WITH F1.F11 = "1"
        PRINT F1.*
        ERASE F1
    END_FOR

    FOR F2 IN F2 WITH F2.F21 = "1"
        PRINT F2.*
        ERASE F2
    END_FOR

    This simplifies the internal processing performed by RDO and in general
    will result in the desired action upon the database.

    However, if there is a FOREIGN KEY (or similar constraint) relationship
    from F2 to F1 and the constraint is evaluated at verb time, then this
    loop unbundling will result in an unexpected constraint violation.

    %RDB-E-INTEG_FAIL, violation of constraint F2_FOREIGN_0001 caused
    operation to fail
    -RDB-F-ON_DB, on database DISK1:[SMITH.WORK]FORKEY_TEST.RDB;1

    To avoid such problems, you should either evaluate the constraint at
    commit time, or modify the nested loop so that there is a reference in
    the inner loop to context of the outer loop.  See the underlined portion
    of the following example.

    FOR F1 IN F1 WITH F1.F11 = "1"
        PRINT F1.*
        FOR F2 IN F2 WITH F2.F21 = F1.F11
                          _______________
            PRINT F2.*
            ERASE F2
        END_FOR
        ERASE F1
    END_FOR
Close Help