oracle使用游标作为传入参数如何处理
如下:
create or replace PROCEDURE insert_pmc_t_d(
p_PMC_TOTAL in CURSOR ,
p_PMC_TOTAL_DETAILS in CURSOR
)
AS
BEGIN
FOR c1 IN p_PMC_TOTAL LOOP
Insert Into T_PMC_TOTAL(ID,PMC_YEAR,MONTHS,DEPARTMENT_CODE,OPERATOR,HANDLING_DATES,NUMBERS,REMARKS,OPERATOR_PZ,OPERATE_SH,OPERATOR_HQ)
Values(SE_T_PMC_TOTAL.NEXTVAL,c1.PMC_YEAR,c1.MONTHS,c1.DEPARTMENT_CODE,c1.OPERATOR,c1.HANDLING_DATES,c1.NUMBERS,c1.REMARKS,c1.OPERATOR_PZ,c1.OPERATE_SH,c1.OPERATOR_HQ);
UPDATE maxbh
set numbers=c1.numbers
where names='T_PMC_TOTAL';
end loop;
FOR c2 IN p_PMC_TOTAL_DETAILS LOOP
Insert Into T_PMC_TOTAL_DETAILS(ID,COMMODITIES_MALE_N,AMOUNTS,NUMBERS,NUMBERS_MALE,REMARKS)
Values(SE_T_PMC_TOTAL_DETAILS.NEXTVAL,c2.COMMODITIES_MALE_N,c2.AMOUNTS,c2.NUMBERS,c2.NUMBERS_MALE,c2.REMARKS);
UPDATE maxbh
set numbers=c2.numbers
where names='T_PMC_TOTAL_DETAILS';
end loop;
commit;
END;
提示
错误(1): PL/SQL: Compilation unit analysis terminated
错误(3,25): PLS-00201: 必须声明标识符 'CURSOR'
新手分不多求大神指点
------解决方案--------------------cursor是不可以直接作为参数传入存储过程的,你试试sys_refcursor或者REF cursor这种类型
------解决方案--------------------你google一下试过没有,假如oracle不支持你就换个思路。
把用参数传递进来,建立游标处理。