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

<2>   The DataServer uses the cursor to compare schema information. It does not fetch any column values.

<3>   The single lookahead cursor selects columns directly. It ignores the field list because the FOR EACH loop defaults to a SHARE-LOCK. Also, since FOR EACH loops do not guarantee order of retrieval, the DataServer has not added an ORDER BY clause. The DataServer called OCIStmtFetch to fetch an array of rows. The DataServer used the default cache-size of 8192. Since 472 bytes are required for each row, it used 8024 bytes of cache to fetch up to 17 rows each call. Processing the 85 rows in the CUSTOMER table required a total of 5 array fetches.

FOR EACH customer FIELDS (name custnum postalcode):
  DISPLAY customer.name customer.custnum customer.postalcode.
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 OCIHandleAlloc <0>
 OCI call OCIStmtPrepare <3>     sqlcrc = 60425
     SELECT /*+ INDEX_ASC(T0 CUSTOMER##CUST_NUM)  */ PROGRESS_RECID un
     ique_id_0,CUST_NUM,COUNTRY,NAME,ADDRESS,ADDRESS2,CITY,STATE,POSTA
     L_CODE,CONTACT,PHONE,SALES_REP,CREDIT_LIMIT,BALANCE,TERMS,DISCOUN
     T,COMMENTS,PROGRESS_RECID FROM DOCTEST.CUSTOMER T0
 OCI call OCIStmtExecute <3>
 OCI call OCIStmtFetch <3>
 OCI call OCIStmtFetch <3>
 OCI call OCIStmtFetch <3>
 OCI call OCIStmtFetch <3>
 OCI call OCIStmtFetch <3>
 OCI call omru   <3>
       Cursor <3> Rows processed 85 (last execution)
      Number of array fetches  5
      Number of rows fetched   85
      Number of array rows     17
      Number of array columns  18
      Number of tables         1
      Space for one row        472
      Requested cache size     8192
      Actual cache size used   8024
 OCI call OCIHandleFree <0>
       Cursor <2> Rows processed 0 (last execution)
 OCI call OCIHandleFree <0>