有人可以解释一下如何使用 EclipseLink 调用存储过程吗?这是我的存储过程:
TYPE nested_varchar2 IS TABLE OF varchar2(15);
TYPE nested_number IS TABLE OF number(1);
procedure set_pacs_state_cond(
icond in varchar2, -- where condition
icheck_state in number, -- check expected current state
iso_id_list out nested_varchar2, -- list of suboperators
ipac_list out nested_varchar2, -- list of pacs
iresult out nested_number -- list of results
);
我使用 EclipseLink 2.4.1 作为 JPA 实现。请在下面查看我的代码。
PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
call.setProcedureName("PCK_PR.set_pacs_state_cond");
call.addNamedArgument("icond", "icond", Types.VARCHAR);
call.addNamedArgument("icheck_state", "icheck_state", Types.NUMERIC);
call.addNamedOutputArgument("iso_id_list", "iso_id_list", Types.ARRAY, "nested_varchar2");
call.addNamedOutputArgument("ipac_list", "ipac_list", Types.ARRAY, "nested_varchar2");
call.addNamedOutputArgument("iresult","iresult", Types.ARRAY, "nested_number");
DataModifyQuery valQuery = new DataModifyQuery();
valQuery.setCall(call);
valQuery.addArgument("icond");
valQuery.addArgument("icheck_state");
valQuery.addArgument("iso_id_list", java.sql.Array.class);
valQuery.addArgument("ipac_list", java.sql.Array.class);
valQuery.addArgument("iresult", java.sql.Array.class);
List test1 = new ArrayList();
List test2 = new ArrayList();
List test3 = new ArrayList();
valQuery.addArgumentValue("WHERE");
valQuery.addArgumentValue(1);
valQuery.addArgumentValue(test1);
valQuery.addArgumentValue(test2);
valQuery.addArgumentValue(test3);
session.executeQuery(valQuery);
List results = (List) session.executeQuery(valQuery);
em.getTransaction().commit();
DatabaseRecord record = (DatabaseRecord)results.get(0);
List ii = (List) record.get("iso_id_list");
List i = (List) record.get("ipac_list");
List r = (List) record.get("iresult");
em.close();
我收到以下错误:
Internal Exception: java.sql.SQLException: ORA-06550: line 5, column 21:
PLS-00201: identifier 'ARRAY' must be declared
ORA-06550: line 5, column 21: