我正在使用hibernate连接到Oracle数据库。
我需要调用一个以对象类型作为输入参数的存储过程。
CREATE OR REPLACE TYPE FIN_GM_WALK_MAN_ADJ_TYPE AS OBJECT
(
ROW_NUM NUMBER,
IMPACT_TYPE_CD VARCHAR2(20 BYTE),
IMPACT_TYPE_NAME VARCHAR2(30 BYTE),
PRODUCT_ID VARCHAR2(30 BYTE),
PRODUCT_FAMILY_ID VARCHAR2(30 BYTE),
INTERNAL_BE VARCHAR2(100 BYTE),
INTERNAL_BSE VARCHAR2(100 BYTE),
EXTERNAL_BE VARCHAR2(100 BYTE),
EXTERNAL_BSE VARCHAR2(100 BYTE),
FIN_SALES_THEATER_NAME VARCHAR2(50 BYTE),
AS_OF_FISCAL_QTR_NUM_INT NUMBER,
CURRENT_FISCAL_QTR_NUM_INT NUMBER,
COGS_REV_CURRENT_QTR_AMT NUMBER,
COGS_REV_PREV_QTR_AMT NUMBER,
COGS_REV_PREV_YEAR_AMT NUMBER,
COGS_REV_QOQ_IMPACT_AMT NUMBER,
COGS_REV_YOY_IMPACT_AMT NUMBER,
SERVICE_FLG CHAR(1 BYTE),
GM_SM_CD VARCHAR2(10 BYTE),
UPLOAD_USER VARCHAR2(20 BYTE),
PURPOSE_OF_PLUG VARCHAR2(50 BYTE)
)
CREATE OR REPLACE TYPE FIN_GM_WALK_MAN_ADJ_LIST AS TABLE OF FIN_GM_WALK_MAN_ADJ_TYPE;
PROCEDURE FIN_GM_WALK_FILE_UPLOAD (
I_GM_WALK_MAN_ADJ_LIST IN FIN_GM_WALK_MAN_ADJ_LIST)
IS
V_ERRMSG VARCHAR2 (500);
BEGIN
DELETE FROM FIN_GM_WALK_MANUAL_ADJ_TEMP;
COMMIT;
FORALL i IN 1 .. I_GM_WALK_MAN_ADJ_LIST.COUNT
INSERT INTO FIN_GM_WALK_MANUAL_ADJ_TEMP
VALUES (I_GM_WALK_MAN_ADJ_LIST (i).ROW_NUM,
I_GM_WALK_MAN_ADJ_LIST (i).IMPACT_TYPE_CD,
I_GM_WALK_MAN_ADJ_LIST (i).IMPACT_TYPE_NAME,
I_GM_WALK_MAN_ADJ_LIST (i).PRODUCT_ID,
I_GM_WALK_MAN_ADJ_LIST (i).PRODUCT_FAMILY_ID,
I_GM_WALK_MAN_ADJ_LIST (i).INTERNAL_BE,
I_GM_WALK_MAN_ADJ_LIST (i).INTERNAL_BSE,
I_GM_WALK_MAN_ADJ_LIST (i).EXTERNAL_BE,
I_GM_WALK_MAN_ADJ_LIST (i).EXTERNAL_BSE,
I_GM_WALK_MAN_ADJ_LIST (i).FIN_SALES_THEATER_NAME,
I_GM_WALK_MAN_ADJ_LIST (i).AS_OF_FISCAL_QTR_NUM_INT,
I_GM_WALK_MAN_ADJ_LIST (i).CURRENT_FISCAL_QTR_NUM_INT,
I_GM_WALK_MAN_ADJ_LIST (i).COGS_REV_CURRENT_QTR_AMT,
I_GM_WALK_MAN_ADJ_LIST (i).COGS_REV_PREV_QTR_AMT,
I_GM_WALK_MAN_ADJ_LIST (i).COGS_REV_PREV_YEAR_AMT,
I_GM_WALK_MAN_ADJ_LIST (i).COGS_REV_QOQ_IMPACT_AMT,
I_GM_WALK_MAN_ADJ_LIST (i).COGS_REV_YOY_IMPACT_AMT,
I_GM_WALK_MAN_ADJ_LIST (i).SERVICE_FLG,
I_GM_WALK_MAN_ADJ_LIST (i).GM_SM_CD,
I_GM_WALK_MAN_ADJ_LIST (i).UPLOAD_USER,
I_GM_WALK_MAN_ADJ_LIST (i).PURPOSE_OF_PLUG);
COMMIT;
END FIN_GM_WALK_FILE_UPLOAD;
我的Java代码是
Query q = session.createSQLQuery(" { call FIN_GM_WALK_FILE_UPLOAD(:recList) }");
q.setParameter("recList",recordList);
其中recordList
是已定义对象的ArrayList
。
它抛出异常。
引起:java.sql.SQLException:ORA-06550:第1行第7列: PLS-00306:调用的参数的数量或类型错误 ' FIN_GM_WALK_FILE_UPLOAD'
有人可以帮我解决这个问题吗?
答案 0 :(得分:1)
你需要这样做
q.setParameterList("recList",recordList);