A result was returned by the statement, when none was expected.
От | Timothy Reaves |
---|---|
Тема | A result was returned by the statement, when none was expected. |
Дата | |
Msg-id | 20021103172018.314040db.treaves@silverfields.com обсуждение исходный текст |
Ответы |
Re: [Solved] A result was returned by the statement, when none was expected.
|
Список | pgsql-jdbc |
Hello all. I'm using PostgreSQL 7.2.2, with the latest JDBC driver, JDK 1.4.1, under linux. In my database, I have several functions defined, and I use them to insert & update rows in the database. Here is an example. create function insert_artist (varchar, int) returns bigint as ' insert into artist (name, genre_loid) values ($1, $2); select currval(\'loid_seq\');' language 'sql'; create function update_artist (varchar, bigint, bigint) returns integer as ' update artist set name = $1, genre_loid = $2 where loid = $3; select 1;' language 'sql'; The insert_artist function returns the last value assigned by a sequence, and update_artist simply returns the integer 1. When executed from psql with: select x_artist(...); all is as expected. When I execute it from Java via: Statement statement = connection.createStatement(); int result = statement.executeUpdate("select x_artist(...)"); the row is updated or inserted, as is the case, but I get the follwoing exception. A result was returned by the statement, when none was expected. at org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:75) at com.silverfields.dbAccess.DBObject.save(DBObject.java:205) What have I done incorrectly? Both functions are defined to return a single value, and Statement.executeUpdate(String) returns a single value.
В списке pgsql-jdbc по дате отправления: