Thread: RE: Why?? executeQuery() & exception: "No results were returnedby the query."
RE: Why?? executeQuery() & exception: "No results were returnedby the query."
From
Joe Shevland
Date:
I believe it should be an exception condition actually, in that the original post was using executeQuery() with a statement that was an update/insert/delete, for which executeUpdate() should be used. Sorry if this argument has been played out, mailbox hell at the mo'. executeQuery() of course won't mind if the result set doesn't contain any rows. If you do have to decide at runtime which one to use (ad-hoc user SQL stuff perhaps), then the execute() method can be used to perform both types and the meta-data interrogated. Regards, Joe > -----Original Message----- > From: pgsql-jdbc-owner@postgresql.org > [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Jeff Duffy > Sent: Wednesday, 9 May 2001 12:05 PM > To: pgsql-jdbc@postgresql.org > Subject: Re: [JDBC] Why?? executeQuery() & exception: "No results were > returnedby the query." > > > > On Tue, 8 May 2001 15:32:19 -0400 (EDT), Bruce Momjian alluded: > > > > > Are you saying that this "no result" error is required by the JDBC > > standard, or is it a PostgreSQL bug? > > The JDBC specification does not address this level of > granularity, but I am > not aware of any other JDBC implementation that considers a > ResultSet of 0 > rows to be an exception condition. So I vote bug. > > Jeff > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) >