DB2 StoredProcedure 的 CallableStatement 抛出 BadSqlGrammarException - 描述符索引无效 (10>9)

问题描述 投票:0回答:1

存储过程: 调用 STORED_PROCEDURE_PROCESS_ONE_TIME(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

存储过程变量:

d Stored_Procedure_Process_One_Time_...
d                 pi
d xterm                          4  0 const
d xdate                          8  0 const
d xsid                          10    const
d xctrnum                        9  0 const
d xpnum                          3  0 const
d xsnum                         11  0 const
d xaflag                         1    const
d xprecv                         5  0 const
d xpScn                          5  0 const
d xptime                         6  0 const
d xzipcde                       11    const
d xlchname                      10    const
d xlchusr                       10    const

我的可调用语句的 Java 代码 [没有输出]:

CallableStatement cs = con.prepareCall(theStoredProcedure);
    cs.setInt(1, 11);
    cs.setInt(2,  20230327);
    cs.setString(3, "NN84567");
    cs.setInt(4, 123);
    cs.setInt(5, 15);
    cs.setInt(6, 849223);
    cs.setString(7, Constants.SP_Y_FLAG);
    cs.setInt(8, 23);
    cs.setInt(9, 57);
    cs.setInt(10, 175255);
    cs.setString(11, "90210");
    cs.setString(12, Constants.USER);
    cs.setString(13, "Matt");
    return cs;
}, (CallableStatementCallback) cs -> {
    cs.execute();
    return true;
}), recover -> {
    log.warn("Exception occurred while making procedure call", recover.getLastThrowable());
    throw new CheckedException("Exception occurred while making procedure call", recover.getLastThrowable());
});

异常: "stack_trace":"<#b6ebaa11> o.s.j.BadSqlGrammarException: CallableStatementCallback; 错误的 SQL 语法 []; 嵌套异常是 java.sql.SQLException: 描述符索引无效。(10>9)

它设置了第 9 个值,但是当它设置第 10 个参数的 int 时,我收到了上述 SQL 异常。

java stored-procedures java-stored-procedures
1个回答
0
投票

给我的存储过程是错误的。我收到错误是因为它只有 9 个元素而不是 13 个。感谢大家的帮助。

© www.soinside.com 2019 - 2024. All rights reserved.