Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> get NumResultCols, any better way?
Hi Oracle/OCI gurus,
What's the best way to know NumResultCols of a query in OCI ?
One naive way is to use the following sequential loop:
BOOL bError = FALSE;
int nNumResultCols = 0;
for (int pos = 1; pos < MAX_NUMBER_OF_ITEMS; pos++) {
rc = odescr(&cda, pos, ...);
if (rc == 1007) break;
if (rc < 0) {
// handle error bError = TRUE; break;
The drawback of the above loop is the inefficiency. odescr() OCI call goes to the server every time you call it. If there are large # of columns in a query, it would be really inefficient.
One way I can think of to improve the efficiency is to call odescr() with a 'pos' picked in binary-searching fashion.
Is there a better way to do it ?
-- james_at_iweave.com James Chen, at Interweave Software, Inc.Received on Fri Mar 14 1997 - 00:00:00 CST
![]() |
![]() |