[英]Failed to return value from Postgres store procedure in Vertx3
I can't seems to get value returned from postgres db...any idea how to fix this ? 我似乎无法从postgres db返回值...任何想法如何解决此问题?
JsonArray outParam = new JsonArray().add("integer");
connection.callWithParams(spAddUser, params, outParam, response -> {
if (response.succeeded()) {
ResultSet result = response.result();
...
I got this error saying: 我收到此错误消息:
org.postgresql.util.PSQLException: No function outputs were registered.
at org.postgresql.jdbc.PgStatement.checkIndex(PgStatement.java:2208)
at org.postgresql.jdbc.PgStatement.checkIndex(PgStatement.java:2191)
at org.postgresql.jdbc.PgStatement.getObject(PgStatement.java:2088)
at com.mchange.v2.c3p0.impl.NewProxyCallableStatement.getObject(NewProxyCallableStatement.java:172)
at io.vertx.ext.jdbc.impl.actions.JDBCCallable.convertOutputs(JDBCCallable.java:83)
at io.vertx.ext.jdbc.impl.actions.JDBCCallable.execute(JDBCCallable.java:59)
at io.vertx.ext.jdbc.impl.actions.JDBCCallable.execute(JDBCCallable.java:33)
at io.vertx.ext.jdbc.impl.actions.AbstractJDBCAction.handle(AbstractJDBCAction.java:48)
Here is my sample store procedure: 这是我的示例存储过程:
create or replace function addUser(_acid int, _slno int, _dob date)
returns int as $$
insert into users (acid,slno,dob)
values (_acid, _slno, _dob)
returning uid;
$$ language sql;
I found out I don't have to pass in the output params if am not using IN/OUT in my stored procedure. 我发现如果未在存储过程中使用IN / OUT,则不必传递输出参数。 So setting output parameter to
null
fixes the problem. 因此,将输出参数设置为
null
可解决此问题。
connection.callWithParams(spAddUser, params, null, response -> {
if (response.succeeded()) {
ResultSet result = response.result();
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.