Skip site navigation (1) Skip section navigation (2)

Re: Num of returned ROWS

From: Mark Lewis <mark(dot)lewis(at)mir3(dot)com>
To: Fernando Hartmann <fh(at)sadig(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Num of returned ROWS
Date: 2005-06-08 17:32:13
Message-ID: 1118251933.24149.48.camel@archimedes.mirlogic.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
executeUpdate() returns the number of rows affected.  There are zero
rows affected by a SELECT COUNT(*) FROM ...

You'll need to use an executeQuery instead.

-- Mark Lewis

On Wed, 2005-06-08 at 08:38 -0300, Fernando Hartmann wrote:
> Oliver Jowett wrote:
> > Fernando Hartmann wrote:
> > 
> > 
> >>    I'm using Postgres 8.0.3 and JDBC build 311 (tried 400 too) and
> >>using executeUpdate to send the following command to DB:
> >>
> >>set datestyle to ISO,DMY;
> >>create table table1 as select F1, sum(F10) from table where F1 between
> >>'1/1/2001' and '31/12/2004' group by F1;
> >>select count(*) from table1
> >>
> >>    But the executeUpdate always return 0, even when the cont(*) return
> >>a number other than 0.
> >>
> >>    Any ideas ?
> > 
> > 
> > The backend doesn't return the number of rows affected for a CREATE
> > TABLE .. AS, so the driver can't give you a useful number.
> > 
> > -O
> > 
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> > 
> 	Ok, but and the last line ? The select count ? They don't return the 
> number of rows too!
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


In response to

pgsql-jdbc by date

Next:From: torbenDate: 2005-06-08 18:21:32
Subject: Jboss and largeObjectManager
Previous:From: Stefan GrasseDate: 2005-06-08 13:07:24
Subject: FW: PostgreSQL JDBC Installation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group