我想使用execute immediate命令,在PROCEDURE下面插入集合
创建或更换程序P_LOAD_HLD( p_app_name IN VARCHAR2, p_filename IN VARCHAR2, p_rectype IN VARCHAR2, p_tabname IN VARCHAR2, o_status OUT号码) IS
type t_tab is table of holding_template%rowtype;
v_tab t_tab;
process_size number := 10000;
dummy_cursor SYS_REFCURSOR;
BEGIN o_status:= 0; 空;
if p_rectype='my_test' THEN
OPEN dummy_cursor FOR
select *
from TAB_staging a
where a.record_type = p_filename;
end if;
LOOP
BEGIN
FETCH dummy_cursor BULK COLLECT INTO V_TAB LIMIT PROCESS_SIZE;
FORALL I IN V_TAB.FIRST .. V_TAB.LAST
execute immediate 'insert into '||p_tabname||' values v_tab(i))';
EXCEPTION WHEN OTHERS THEN
FOR I IN 1 .. V_TAB.COUNT
LOOP
BEGIN
EXECUTE IMMEDIATE ' INSERT INTO '||p_tabname || ' VALUES ( '||
'v_tab(i).k0,v_tab(i).k1,v_tab(i).k2,v_tab(i).k3,v_tab(i).k4';
COMMIT;
EXCEPTION WHEN OTHERS THEN
RAISE;
END;
END LOOP;
END;
END LOOP;
结束P_LOAD_HLD;
这给了我错误信息。
[Error] PLS-00435 (742: 7): PLS-00435: DML statement without BULK In-BIND cannot be used inside FORALL