DELETE LOOP
DECLARE
CURSOR c1 IS
SELECT ROWID FROM /**/QQDW_ORDER_TOT_D --테이블 교체
-- WHERE ROWNUM < 15000000
WHERE ORDER_SEQ = 1 /**/ ; -- 데이터 삭제 조건 지정
nCNT number := 0;
sMSG varchar2(100) := ' ';
BEGIN
BEGIN
FOR cur_rec IN c1 LOOP
delete from /* */QQDW_ORDER_TOT_D --테이블 교체
where rowid = cur_rec.rowid;
nCNT := nCNT + 1;
-- 중간 commit 수행
if mod(nCNT, 1000) =0 then
sMSG := ' '||to_char(sysdate,'MM-DD HH24:MI:SS')||to_char(nCNT,'999,999,990')||' Row Deleted';
commit;
end if;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
sMSG := ' '||to_char(sysdate,'YYYY-MM-DD HH24:MI:SS')||to_char(nCNT,'999,999,990')||' Row Deleted';
DBMS_OUTPUT.PUT_LINE(sMSG );
sMSG := ' '||to_char(sysdate,'YYYY-MM-DD HH24:MI:SS')||'-'||SQLERRM;
DBMS_OUTPUT.PUT_LINE(sMSG );
END;
COMMIT;
DBMS_OUTPUT.PUT_LINE('Delete Cnt = ' || nCNT);
END;