试图调用一个带有8个参数的oracle存储过程,而第8个是我们需要传递的数组。下面是代码段,并且抛出错误。我不确定将什么传递给createDescriptor方法作为参数1,因为无论传递什么,都会产生相同的错误。我从以下链接中获取了Fields继承的part的值(将非常感谢您的帮助)https://docs.oracle.com/cd/E16338_01/appdev.112/e13995/oracle/sql/ArrayDescriptor.html
java.sql.SQLException:无法构造描述符:无法解析java.sql.SQLException:无法构造描述符:TYPECODE_VARCHAR2
代码:
structDescriptor = StructDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection());
arrayDescriptor = ArrayDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection());
ARRAY arr = new ARRAY(arrayDescriptor, oracleConnection.getMetaData().getConnection(), accountArray);
try {
//Array array = oracleConnection.createARRAY("OBJECT", new Object[] { "176354516912167301", "177254516082228201" });
OracleCallableStatement cstmt = (OracleCallableStatement) oracleConnection.prepareCall("{call COPY_FUNCTIONALITY.COPY_ADDRESS(?,?,?,?,?,?,?,?)}");
cstmt.setString(1, "ABCD");
cstmt.setString(2, "PASZKAL");
cstmt.setString(3, "624954458340565301");
cstmt.setString(4, "ALL");
cstmt.setString(5, "RECURRING_ENTERED");
cstmt.setBoolean(6, false);
cstmt.setBoolean(7, false);
cstmt.setArray(8, arr);
//cstmt.setArray(8, array_to_pass);
ResultSet rs = cstmt.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}