CREATE OR REPLACE PROCEDURE SP_DEL AS CURSOR CUR_A IS SELECT ID FROM AX; V_TEMP VARCHAR2(100); BEGIN OPEN CUR_A; LOOP FETCH CUR_A INTO V_TEMP; EXIT WHEN CUR_A%NOTFOUND; DELETE(V_TEMP);--调用你的delete方法 END LOOP; CLOSE CUR_A; END;
beginfor del in (select b from a) loopDelete(del.b); end loop;end;
Declare type ty_A is table of A表.记录字段%type index by binary_integer; v_记录字段 ty_A; Begin select a.记录字段 Bulk Collect Into v_记录字段 from A表 a ; For x In 1 .. v_记录字段.Count loop
delete是一个存储过程, 删除的是多张表数据,我现在就是要把A表里的所有数据查询出来,将每个记录的字段X传给存储过程,然后执行Delete(X) 这样就可以了
CREATE OR REPLACE PROCEDURE SP_DEL
AS
CURSOR CUR_A IS SELECT ID FROM AX;
V_TEMP VARCHAR2(100);
BEGIN
OPEN CUR_A;
LOOP
FETCH CUR_A INTO V_TEMP;
EXIT WHEN CUR_A%NOTFOUND;
DELETE(V_TEMP);--调用你的delete方法
END LOOP;
CLOSE CUR_A;
END;
end loop;end;
type ty_A is table of A表.记录字段%type index by binary_integer;
v_记录字段 ty_A;
Begin
select a.记录字段 Bulk Collect
Into v_记录字段
from A表 a
;
For x In 1 .. v_记录字段.Count loop
delete(v_记录字段(x));
Commit;
End Loop;
End;
试试