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: To know the number of results returned just after query ??

Re: To know the number of results returned just after query ??

From: John Russell <johnrussell10_at_home.com>
Date: Sat, 04 Aug 2001 03:36:13 GMT
Message-ID: <n4rmmtcb3krrls45ftms67d2o7657p46td@4ax.com>

I have this notion of using either a GROUP BY ROLLUP (...) or COUNT(*) OVER( ) to get the count of the number of rows as the first row of the result set, without disturbing the rest of the rows.

Last time I tried this, I didn't have much experience with these constructs and couldn't get it to work for an arbitrary query. I think it needed a guaranteed unique column so that GROUP BY wouldn't eliminate any rows. Maybe GROUP BY ROLLUP(rownum) or rowid?

John

On Fri, 03 Aug 2001 14:56:46 GMT, "Jim Kennedy" <kennedy-family_at_home.com> wrote:

>That will only have the number of rows once you have fetched them all.
>Oracle doesn't know how many rows a query returns until all the results are
>fetched.
>Jim
>"Keith Jamieson" <Keith.Jamieson_at_phoenix.ie> wrote in message
>news:9kdrlt$81l$1_at_kermit.esat.net...
>> What about v_rowcount := SQL%ROWCOUNT;
>>
>>
>> Jim Kennedy wrote in message ...
>> >Very expensive. You end up doing 2 queries of every one or retrieving
 the
>> >entire result set 2x.
>> >Jim
>> >"Isma" <Isma_at_iballo.com> wrote in message
>> >news:3B6958BF.1B0AFF3F_at_iballo.com...
>> >> Hi,
>> >>
>> >> I use a JDBC driver. I want to know whether exists a command to know
 the
>> >> results number just after the query.(i.e. lines)
>> >>
>> >> [I know it exists getColumnCount() to know the number of columns return
>> >> ..
>> >> int numcols = rsmd.getColumnCount();
>> >> ]
>> >>
>> >> stmt.execute(sql)
>> >> ResultSet rs = stmt.getResultSet();
>> >> ResultSetMetaData rsmd = rs.getMetaData();
>> >>
>> >>
>> >> What about getfetchSize() ??? it always return 10 whatever returned
>> >> results.
>> >>
>> >>
>> >
>> >
>>
>>
>

--
Got an Oracle database question?
Try the search engine for the database docs at:
http://tahiti.oracle.com/
Received on Fri Aug 03 2001 - 22:36:13 CDT

Original text of this message

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