Deprecated Statement Functions

Table E-3 lists the deprecated Statement functions that are described in this section.

Table E-3 Deprecated Statement Functions

Function Purpose


Fetch rows from a query.



Fetches rows from a query. This function is deprecated. Use OCIStmtFetch2().


sword OCIStmtFetch ( OCIStmt     *stmtp,
                     OCIError    *errhp, 
                     ub4         nrows,
                     ub2         orientation,
                     ub4         mode );


stmtp (IN)

A statement (application request) handle.

errhp (IN)

An error handle that you can pass to OCIErrorGet() for diagnostic information when there is an error.

nrows (IN)

Number of rows to be fetched from the current position.

orientation (IN)

Before release 9.0, the only acceptable value is OCI_FETCH_NEXT, which is also the default value.

mode (IN)



The fetch call is a local call, if prefetched rows suffice. However, this is transparent to the application.

If LOB columns are being read, LOB locators are fetched for subsequent LOB operations to be performed on these locators. Prefetching is turned off if LONG columns are involved.

This function can return OCI_NO_DATA on EOF and OCI_SUCCESS_WITH_INFO when one of these errors occurs:

  • ORA-24344 - Success with compilation error

  • ORA-24345 - A truncation or NULL fetch error occurred

  • ORA-24347 - Warning of a NULL column in an aggregate function

If you call OCIStmtFetch() with the nrows parameter set to 0, this cancels the cursor.

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.

Related Functions

OCIStmtExecute(), OCIStmtFetch2()