Re: Getting the number or row returned by a select. Alway

From: Kris Jurka <books(at)ejurka(dot)com>
To: David Gagnon <dgagnon(at)siunik(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Getting the number or row returned by a select. Alway
Date: 2005-04-15 20:04:06
Message-ID: Pine.BSO.4.56.0504151459290.21687@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 15 Apr 2005, David Gagnon wrote:

> So did I miss something obvious. Is it possible to get the total number
> of row returned from a query without doing another select.
>

Anytime you've got the results of a query you can loop over it to count
the number of elements. In JDBC with a scrollable ResultSet you may issue
rs.last() and rs.getRow() to get the number of rows. rs.beforeFirst()
will then reset the ResultSet back to its original state.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message amp 2005-04-18 06:32:31 Have Question
Previous Message David Gagnon 2005-04-15 19:53:33 Getting the number or row returned by a select. Alway tought it was not possible until I say pgAdmin who gives it