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 -> Re: [Q]How to get row count in select stmt in OCI

Re: [Q]How to get row count in select stmt in OCI

From: Jasper Stil <dirkstil_at_euronet.nl>
Date: Tue, 26 Oct 1999 18:52:18 +0200
Message-ID: <kNoVOBzfmRbkKM18LxHBZgXpqSp+@4ax.com>


If you need the total count for display purposes _at forehand_, you are out of luck: count() with the same where clause is the only way to go as far as I know. There's a 4-byte signed integer rpc ('rows processed count') in the CDA structure (bytes 4-7 on a Win32 platform), but this does exactly as it says: while fetching, it is incremented by the number of rows processed. When you have fetched all, it reflects the rowcount.

If it's just to know if you can fetch again, don't worry. The next fetch after the last row returns no_data_found. Just trap that and you're done.

Have fun.

JasperD

"jmseo" <jmseo2000_at_netsgo.com> wrote:

>Hi,
>
>I'm programming with OCI.
>To get the select result, it calls oexec() and ofetch().
>My problem is that I have to know the result row numbers before calling
>ofetch().
>
>I think there would be some data structure that keep statistic information,
>but I cannot find it.
>
>The easy way is to execute "select count(*).." before executing select
>statement,
>but it may cost too much. If anybody has an answer for it, please let me
>know...
>
>Regards,
>
>Jungmin Seo
>
>
>
Received on Tue Oct 26 1999 - 11:52:18 CDT

Original text of this message

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