java - "A result was returned when none was expected" exception on JDBCTemplate update execution -
i trying execute function via postgresql update() method, throws me exception - "a result returned when none expected".
postgresql function:
create or replace function create_order(note varchar, created_by bigint, service_request bigint) returns table (service_order integer, note varchar) begin insert service_order (note, service_request_fk, created_by, so_status_type_fk, price_total, created) values (note, service_request, created_by, 1, 0, now()); end; $$ language plpgsql;
sql, trying execute:
string sql = "select create_order(?,?,?)";
the update function:
int id = jdbc.update(sql, new object[] {order.getnote(), emp.getemployeeid(), order.getservicerequestid()});
the function must return void means nothing, seems me, returns table without rows, jdbctemplate consider table.
how can avoid exception?
you using select statement when using stored procedure; must use call.
http://www.postgresql.org/docs/7.4/static/jdbc-callproc.html
Comments
Post a Comment