以下是我的 pl\sql 和 java 用法:
PL\SQL:
procedure getDetails(id in number,
varArray out var_array,
valArray out var_array,
anotherArray out var_array,
description out varchar2 )
type var_array IS table of VARCHAR2(255) index by BINARY_INTEGER;
爪哇:
CallableStatement cstmt = (OracleCallableStatement) conn.prepareCall("{call pkg.getDetails(?,?,?,?,?)}");
cstmt.setInt(1, Integer.parseInt(resultList.get(0).trim()));
cstmt.registerOutParameter(2, oracle.jdbc.OracleTypes.ARRAY);
cstmt.registerOutParameter(3, oracle.jdbc.OracleTypes.ARRAY);
cstmt.registerOutParameter(4, oracle.jdbc.OracleTypes.ARRAY);
cstmt.registerOutParameter(5, oracle.jdbc.OracleTypes.VARCHAR);
cstmt.execute();
我在执行调用时遇到错误:
java.sql.SQLException:ORA-06550:第 1 行,第 7 列:PLS-00306:调用“GETDETAILS”时参数的数量或类型错误