Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> How to stop an OCI query?
What's the correct condition to check in order to stop
a running OCI query? I have tried several approaches
(see below) but I can't seem to find the right one.
The following gives me too few records:
while ((result = OCIStmtFetch2(select, errhp, 1, OCI_FETCH_NEXT, 0,
OCI_DEFAULT)) == OCI_SUCCESS) { OCIStmtFetch2(select, errhp, 1, OCI_FETCH_NEXT, 0, OCI_DEFAULT);
// retrieve record
}
And the following works sometimes but it can also result in too many iterations (infinite loop):
while ((result = OCIStmtFetch2(select, errhp, 1, OCI_FETCH_NEXT, 0,
OCI_DEFAULT)) == OCI_SUCCESS || result == OCI_ERROR) { OCIStmtFetch2(select, errhp, 1, OCI_FETCH_NEXT, 0, OCI_DEFAULT);
// retrieve record
}
At some point I tried to run a COUNT(1) query first and then I queried for the actual data like this:
for (i = 1; i <= numberOfRecords; i++) {
OCIStmtFetch2(select, errhp, 1, OCI_FETCH_NEXT, 0, OCI_DEFAULT)
// retrieve record
}
I am not even sure that the above code is working properly in all cases.
This problem has been haunting me for a while. Thanks for your kind assistance...
-Ramon F. Herrera Received on Mon Aug 11 2003 - 22:52:10 CDT
![]() |
![]() |