Oracle Call Interface Programmer's Guide Release 2 (9.2) Part Number A96584-01 |
|
More OCI Relational Functions, 4 of 106
This fetches a row from the (scrollable) result set. You are encouraged to use this fetch call instead of the deprecated call OCIStmtFetch()
.
sword OCIStmtFetch2 ( OCIStmt *stmthp, OCIError *errhp, ub4 nrows, ub2 orientation, sb4 fetchOffset, ub4 mode );
This is the statement handle of the (scrollable) result set.
An error handle you can pass to OCIErrorGet()
for diagnostic information in event of an error.
Number of rows to be fetched from the current position.
The acceptable values are:
fetchOffset
parameter) in the result set using absolute positioning.fetchOffset
parameter) in the result set using relative positioning.The offset to be used with the orientation parameter for changing the current row position.
Pass in OCI_DEFAULT.
OCIStmtFetch()
call with the addition of the fetchOffset
parameter. It can be used on any statement handle, whether it is scrollable or not. For a non-scrollable statement handle, the only acceptable value of orientation
is OCI_FETCH_NEXT, and the fetchOffset
parameter will be ignored. For new applications you are encouraged to use this new call, OCIStmtFetch2()
. A fetchOffset
with orientation
set to OCI_FETCH_RELATIVE is equivalent to all of the following:
fetchOffset
equal to 0,fetchOffset
equal to 1,fetchOffset
equal to -1.All other orientation modes besides OCI_FETCH_ABSOLUTE and OCI_FETCH_RELATIVE will ignore the fetchOffset
value.
This call can also be used to find out the number of rows in the result set by using OCI_FETCH_LAST, and then calling OCIAttrGet()
on OCI_ATTR_CURRENT_POSITION. But the response time of this call can be high.
The return codes are the same as for OCIStmtFetch()
, except that OER(1403) with return code OCI_NO_DATA will be returned every time a fetch on a scrollable statement handle (or execute) is made and not all rows requested by the application could be fetched.
The scrollable statement handle will need to be explicitly cancelled (that is, fetch with 0 rows) or freed in order to release server-side resources for this scrollable cursor. A non-scrollable statement handle is implicitly cancelled on receiving the OER(1403).
Use OCI_ATTR_ROWS_FETCHED to find the number of rows that were successfully fetched into the user's buffers in the last fetch call.
See Also:
"Scrollable Cursors" for more information on this topic |
OCIStmtExecute(), OCIBindByPos()
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|