In Query 13 presented in this section, note the following points related to cursor behavior:

<2>   The DataServer uses the cursor to compare schema information and fetch CUSTOMER rows.

<3>   The DataServer uses the cursor to compare schema information. It does not fetch any column values. Note that because the ORDER_ table contains a date, the DataServer does not reuse this cursor to fetch column values.

<4>   The DataServer uses a lookahead cursor to select fields in the field list in addition to those required by the client.

<5>   The lookahead cursor selects fields from the ORDER_ table that correspond to a particular CUSTOMER row (WHERE CUST_NUM = :1).

FOR EACH customer FIELDS (name custnum postalcode) NO-LOCK,
  EACH order FIELDS (orderdate salesrep) OF customer NO-LOCK
    QUERY-TUNING (NO-JOIN-BY-SQLDB):
  DISPLAY customer.name customer.custnum customer.postalcode
    order.orderdate order.salesrep.
END.
OCI call OCIStmtPrepare <2>     sqlcrc = 41633
    SELECT /*+ INDEX(T0 CUSTOMER##PROGRESS_RECID) */ * FROM DOCTEST.C
    USTOMER T0 WHERE PROGRESS_RECID = :rid
OCI call OCIStmtExecute-DescribeOnly <2>
OCI call omru   <2>
OCI call OCIStmtPrepare <3>     sqlcrc = 60664
    SELECT /*+ INDEX(T0 ORDER_##PROGRESS_RECID) */ * FROM DOCTEST.ORD
    ER_ T0 WHERE PROGRESS_RECID = :rid
OCI call OCIStmtExecute-DescribeOnly <3>
OCI call omru   <3>
OCI call OCIStmtPrepare <4>     sqlcrc = 40887
    SELECT /*+ INDEX_ASC(T0 CUSTOMER##CUST_NUM)  */ PROGRESS_RECID un
    ique_id_0,CUST_NUM,NAME,POSTAL_CODE FROM DOCTEST.CUSTOMER T0
OCI call OCIStmtExecute <4>
OCI call OCIStmtPrepare <5>     sqlcrc = 17552
    SELECT /*+ INDEX_ASC(T0 ORDER_##CUST_ORDER)  */ PROGRESS_RECID un
    ique_id_0,CUST_NUM,ORDER_DATE,SALES_REP FROM DOCTEST.ORDER_ T0 WH
    ERE (CUST_NUM = :1)
OCI call OCIStmtExecute <5>
	< repeat for each row >
     Cursor <4> Rows processed 85 (last execution)
     Number of array fetches  1
     Number of rows fetched   85
     Number of array rows     105
     Number of array columns  4
     Number of tables         1
     Space for one row        78
     Requested cache size     8192
     Actual cache size used   8190
OCI call OCIHandleFree <0>
     Cursor <5> Rows processed 0 (last execution)
     Total Rows processed     207 (previous executions)
     Number of array fetches  0
     Number of rows fetched   0
     Number of array rows     141
     Number of array columns  4
     Number of tables         1
     Space for one row        58
     Requested cache size     8192
     Actual cache size used   8178