OCI error 1002
From: Ian J Hogg <ianhogg_at_cs.umn.edu>
Date: 1997/02/12
Message-ID: <5dt48u$519_at_epx.cis.umn.edu>#1/1
}
}
Date: 1997/02/12
Message-ID: <5dt48u$519_at_epx.cis.umn.edu>#1/1
I'm developing an application with Oracle 7.3.2.1.0 on Digital Unix 3.2 using non-blocking mode. I am encountering situations where in my ofen loop I am getting ORA-01002: fetch out of sequence. In the previous iteration the cda.rc value is 0 not 1403. I have determined that when this happens, the previous ofen actually fetched the last set of rows.
Here's the a sample of my code:
void OCIDB::fetch_rows(sword ncols, ostrstream *res_ostr)
{
ub4 n_rows = 0;
for (;;) {
/* Fetch a row. Break on end of fetch,
disregard null fetch "error". */
do {
int retval = ofen(&cda, nrows_fetch);
cout << "ofen returned " << retval << ", cda.rc = " << cda.rc
<< endl;
} while (cda.rc == BLOCKED);
if (cda.rc != SUCCESS) {
if (cda.rc != NULL_VALUE_RETURNED && cda.rc != NO_DATA_FOUND) {
oci_error();
logFatal << "OCI Error after " << n_rows << ": "
<< strerror(errno) << endm;
exit(1);
}
if ((cda.wrn & 0x1) && (cda.wrn & 0x2)) {
cout << "***** ERROR ****** data truncated" << endl;
}
}
// the rpc is cumulative, so we need to calculate how many returned
// in this fetch.
ub4 nr = cda.rpc - n_rows;
n_rows = cda.rpc;
cout << "got " << nr << " in this fetch (wanted " << nrows_fetch
<< ")" << endl;
for (int row = 0; row < nr; row++) {
// process each row returned, not important for this sample.
}
if (cda.rc == NO_DATA_FOUND) {
break;
}
}
}
--
===============================================================================
Ian Hogg ianhogg_at_cs.umn.edu
(612) 424-6332
Received on Wed Feb 12 1997 - 00:00:00 CET
