这是我写的存储过程
CREATE OR REPLACE PROCEDURE "public"."pr_student_verify"(IN "p_school_id" varchar, IN "p_class_id" varchar, IN "p_student_code" varchar, INOUT "p_result_code" varchar)
然后调用
Sql sql = Sqls.create("call pr_student_verify(@p_school_id,@p_class_id,@p_student_code,@OUTp_result_code)");
//sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao.getEntity(Testaaa.class));
sql.params().set("p_school_id", "680873162103066624"); // 设置入参
sql.params().set("p_class_id", "680874050016251904"); // 设置入参
sql.params().set("p_student_code", "10186csxxyx0010001"); // 设置入参
sql.params().set("OUTp_result_code", Types.VARCHAR);// 设置出参类型,注意,必须加OUT开头
dao.execute(sql);
Record re = sql.getOutParams();
然后报错
Caused by: org.postgresql.util.PSQLException: 这个 statement 未宣告 OUT 参数,使用 { ?= call ... } 宣告一个。
at org.postgresql.jdbc.PgCallableStatement.registerOutParameter(PgCallableStatement.java:205)
at com.zaxxer.hikari.pool.HikariProxyCallableStatement.registerOutParameter(HikariProxyCallableStatement.java)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runExec(NutDaoExecutor.java:148)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:68)
... 90 common frames omitted
CREATE OR REPLACE PROCEDURE "public"."pr_student_verify"(IN "p_school_id" varchar, IN "p_class_id" varchar, IN "p_student_code" varchar, INOUT "p_result_code" varchar)
CREATE OR REPLACE PROCEDURE "public"."pr_student_verify"(IN "p_school_id" varchar, IN "p_class_id" varchar, IN "p_student_code" varchar, INOUT "p_result_code" varchar)