这是我的存储过程。
CREATE OR REPLACE PROCEDURE comm_rept (p_manager_sales_pos_id NUMBER)
IS
v_sales_in_dollar NUMBER;
t_TBL_sales_pos_id t_sales_rep.sales_pos_id%rowtype;
t_TBL_commission t_sales_rep.commission%rowtype;
v_sales_pos_id t_TBL_sales_pos_id;
v_commission t_TBL_commission;
CURSOR cur_sales IS
SELECT sales_pos_id,ROUND(((commission*100)/SALES_IN_DOLLAR),2) FROM t_sales WHERE sales_pos_id IN
(SELECT sales_pos_id FROM t_sales_rep WHERE manager_sales_pos_id = p_manager_sales_pos_id);
BEGIN
OPEN cur_sales;
FETCH cur_sales BULK COLLECT INTO v_sales_pos_id,v_commission;
FORALL i in 1..v_count() = 0
LOOP
INSERT INTO t_commission_report (MGR_ID,SALES_POS_ID,COMMISSION) VALUES (p_manager_sales_pos_id,v_sales_pos_id(i),v_commission(i));
END LOOP;
CLOSE cur_sales;
END comm_rept;
/
帮助我,我不想执行它但想要找出确切的错误。让我知道找出错误的方法。
答案 0 :(得分:2)
您的FORALL
语法错误;它应该类似于以下内容,没有LOOP
:
FORALL I IN 1 .. SOMETHING
INSERT INTO SOME_TABLE(...)
VALUES ...