Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> How to stop an OCI query?

How to stop an OCI query?

From: Ramon F Herrera <ramon_at_conexus.net>
Date: 11 Aug 2003 20:52:10 -0700
Message-ID: <c9bc36ff.0308111952.4694e2cf@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US