Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to get total number of rows before executing the sql /fetch
Gary England wrote:
>
> Sidhartha Sahoo wrote:
> >
> > We want to know the toal number of rows expected in a cursor fetch
> > before doing actual fetch. (before executing)
> >
> > thanks
> >
> > Sidhartha
>
> Computers are not clairvoyant. The best shot you have isto duplicate
> the query with "COUNT(*)".
I would be cautious with useing the count(*), as the query is not exactly like the one you are attempting to do the query will not be cached already and will need to be reparsed when the second query runs. Also, if you are trying to determine, by the number of rows returned that the query may be long-running due to possible amount of rows returned, you will be defeating your purpose (as you will have done that long-running query to determine the number of rows that will be returned so the user can decide if they really want to do that long running query... kinda a catch 22)...
ken
-- Ken Niedermeyer Boeing Central Information Systems Ken.Niedermeyer_at_boeing.com This posting represents the personal opinions of the author. It is not the official opinion or policy of the author's employer. Warranty expired when you opened this article and I will not be responsible for its contents or use.Received on Fri Sep 26 1997 - 00:00:00 CDT