Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: OCI related
mkaushik_at_harvestinc.com wrote:
> OCIStmntExecute( ) returns the status of executing a SQL query.
> It also returns a special status if no result rows were returned.
> But is there a way to find the number of result rows that were
> returned before doing a OCIStmtFetch()? (equivalent to a Sybase DBCOUNT() )
<remaining text deleted>
According to what I've read from Oracle, if you want a row count you need to execute a "select count...." statement. .....Then you've got a race condition if you're relying on that count to be accurate while you prepare to select data from those counted rows...... You aren't able to ask the server to predict how many rows a fetch will return.
Not knowing what you're trying to do, let me just say what I've found.... IMHO, the only real approach is not to code with that paradigm. If you're wanting to know a row count so you can pre-allocate memory for your define host variables, I don't think you'll find a method that can avoid a race condition. As an alternative, I have typically shoved fetched data into a linked list where the links are dynamically allocated one-at-a-time in the fetch loop. Or you might use the OCI dynamic defines with callbacks that dynamically allocate memory to hold the data.
Forgive me if I'm misreading the question..... my brain is stretched a little
thin writing a multi-threaded OCI application.
r,
Lance S. Nehring
Received on Thu Apr 09 1998 - 22:17:37 CDT
![]() |
![]() |