我似乎无法从postgres db中获得价值...任何想法如何解决这个问题?
JsonArray outParam = new JsonArray().add("integer");
connection.callWithParams(spAddUser, params, outParam, response -> {
if (response.succeeded()) {
ResultSet result = response.result();
...
我收到此错误说:
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)
这是我的示例商店程序:
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;
答案 0 :(得分:1)
如果我的存储过程中没有使用IN / OUT,我发现我不必传入输出参数。因此,将输出参数设置为null
可以解决问题。
connection.callWithParams(spAddUser, params, null, response -> {
if (response.succeeded()) {
ResultSet result = response.result();
...