【发布时间】:2019-02-13 14:19:12
【问题描述】:
我在 Oracle 12c DB 中有一个带有以下签名的存储过程:
create or replace PROCEDURE myproc(param1 IN NUMBER, param2 IN STRING_ARRAY, param3 IN STRING_ARRAY, outparam OUT BOOLEAN) IS
这里的STRING_ARRAY定义如下:
create or replace TYPE STRING_ARRAY AS VARRAY(1000) OF VARCHAR2(4000);
在我的 dao 层中,我通过以下方式调用它:
SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate).withProcedureName("myschema.myproc");
SqlTypeValue param2ArrayValue = new AbstractSqlTypeValue() {
protected Object createTypeValue(Connection conn, int sqlType, String typeName) throws SQLException {
ARRAY array = ((OracleConnection) conn).createARRAY("myschema.STRING_ARRAY", param2Values);
return array;
}
};
SqlTypeValue param3ArrayValue = new AbstractSqlTypeValue() {
protected Object createTypeValue(Connection conn, int sqlType, String typeName) throws SQLException {
ARRAY array = ((OracleConnection) conn).createARRAY("myschema.STRING_ARRAY", param3Values);
return array;
}
};
SqlParameterSource inParams = new MapSqlParameterSource().addValue("param1", param1Value)
.addValue("param2", param2ArrayValue)
.addValue("param3", param3ArrayValue);
Map<String, Object> outParams = simpleJdbcCall.execute(inParams);
logger.info("RetFlag:::::" + outParams.get("outparam"));
我收到以下异常::
org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call myschema.myproc(?, ?, ?, ?)}]; SQL state [99999]; error code [17004]; Invalid column type: 1111; nested exception is java.sql.SQLException: Invalid column type: 1111
Caused by: java.sql.SQLException: Invalid column type: 1111
我参考了以下链接:: Spring Forum link 1
谁能提供任何解决方案?
【问题讨论】:
标签: java oracle12c spring-jdbc