Try OpenEdge Now
skip to main content
DataServer for Oracle
Sample Queries : Query 11
 

Query 11

In Query 11 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 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 cursor is used to perform the join by the SQLDB. The join still requires a lookahead cursor.
<5>   Since the query requests the ORDER_ row with a SHARE-LOCK, the DataServer must refetch each ORDER_ row to get all the columns. If the ORDER_ table did not have a record identifier (PROGRESS_RECID in this case), this query would fail. If you must retrieve the ORDER_ row with a SHARE-LOCK, removing the field list eliminates the need to refetch the row.
FOR EACH customer FIELDS (name custnum postalcode) NO-LOCK,
  EACH order FIELDS (orderdate salesrep) OF customer SHARE-LOCK:
  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.CUSTOMER T0 WHERE PROGRESS_RECID = :rid
OCI call OCIStmtExecute-DescribeOnly <2>
OCI call omru <2>
OCI call OCIHandleAlloc <0>
OCI call OCIStmtPrepare <3> sqlcrc = 60664
SELECT /*+ INDEX(T0 ORDER_##PROGRESS_RECID) */ * FROM
DOCTEST.ORDER_ T0 WHERE PROGRESS_RECID = :rid
OCI call OCIStmtExecute-DescribeOnly <3>
OCI call omru <3>
OCI call OCIHandleAlloc <0>
OCI call OCIStmtPrepare <4> sqlcrc = 51753
SELECT T0.PROGRESS_RECID unique_id_0,T0.CUST_NUM,T0.NAME,
T0.POSTAL_CODE,T1.PROGRESS_RECID unique_id_1,T1.ORDER_DATE,
T1.SALES_REP FROM DOCTEST.CUSTOMER T0,DOCTEST.ORDER_ T1 WHERE
(T1.CUST_NUM = T0.CUST_NUM)
OCI call OCIStmtExecute <4>
OCI call OCIStmtFetch <4>
OCI call OCIStmtFetch <4>
OCI call OCIHandleAlloc <0>
OCI call OCIStmtPrepare <5> sqlcrc = 18715
SELECT /*+ INDEX(T0 ORDER_##PROGRESS_RECID) */ ORDER_NUM,CUST_NUM
,TO_CHAR(ORDER_DATE,'YYYYMMDDHH24MISS'),TO_CHAR(SHIP_DATE,'YYYYMM
DDHH24MISS'),TO_CHAR(PROMISE_DATE,'YYYYMMDDHH24MISS'),CARRIER,INS
TRUCTIONS,PO,TERMS,SALES_REP,PROGRESS_RECID FROM DOCTEST.ORDER_
T0 WHERE PROGRESS_RECID = :rid
OCI call omru <5>
OCI call OCIStmtExecute <5>
< repeat for each row >
OCI call OCIStmtExecute <5>
OCI call omru <4>