Chris Pratt wrote:
>
> Oh, I should have mentioned, that using simple SQL, you can also use the
> COUNT operator to test how many rows will be returned. Like this:
>
> select count(*) from employees where city='San Jose'
> select * from employees where city='San Jose'
Thank you!
So another question is: is the first query as time-comsuming as the 2nd
one?
if this is true, i'd rather do only one query.
thanks!
xizhen
>
> The first query will return a single row in its ResultSet that consists of
> one Numeric value equal to the number of rows that the second query will
> return (Assuming that no updates happen between the two invocations).
> (*Chris*)
>
> ----- Original Message -----
> From: Chris Pratt <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Monday, June 28, 1999 2:42 PM
> Subject: Re: Number of rows a query retrieved?
>
> > In standard JDBC, there is no way to tell this before you have read the
> last
> > row. There are packages, like Village or Town, that do have this
> > capability, but I have not tested them. You could also use a true OODB,
> > like CloudScape, which has this type of capability.
> > (*Chris*)
> >
> > ----- Original Message -----
> > From: Xizhen Wang <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, June 28, 1999 12:44 AM
> > Subject: Number of rows a query retrieved?
> >
> >
> > > Hi! In jdbc, how to know the number of rows a query retrieved? Is there
> > > a good way other than using ResultSet.next()?
> > >
> > > Thanks!
> > >
> > >
> >
> ___________________________________________________________________________
> > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > > of the message "signoff SERVLET-INTEREST".
> > >
> > > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > Resources: http://java.sun.com/products/servlet/external-resources.html
> > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> > >
> >
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html