DECLARE
CURSOR c_partition IS
SELECT rowid FROM cmp_credit_gimap_publicno_prot partition(PART_CCGPP_0) WHERE IM_TYPE = '06';
type t_type is table of rowid index by pls_integer;
v_rowid t_type;
p_err_code NUMBER;
p_err_message VARCHAR2(4000);
l_update_cnt NUMBER(12) := 0;
l_start DATE;
l_end DATE;
l_seq NUMBER(12);
v_limit NUMBER := 50000;
BEGIN
l_start := SYSDATE;
l_seq := 0;
OPEN c_partition;
LOOP
FETCH c_partition BULK COLLECT INTO v_rowid LIMIT v_limit;
EXIT WHEN v_rowid.count = 0;
FORALL j IN 1 .. v_rowid.COUNT
DELETE FROM cmp_credit_gimap_publicno_prot where rowid = v_rowid(j);
l_update_cnt := l_update_cnt + SQL%ROWCOUNT;
l_seq := l_seq + 1;
INSERT INTO cmp_solix_log
(table_name, seq_no, begin_time, end_time, cnt)
VALUES
('CMP_CREDIT_GIMAP_PUBLICNO_PROT_0', l_seq, l_start, SYSDATE, l_update_cnt);
COMMIT;
EXIT WHEN c_partition%NOTFOUND;
END LOOP;
CLOSE c_partition;
EXCEPTION
WHEN OTHERS THEN
p_err_code := SQLCODE;
p_err_message := SQLERRM;
ROLLBACK;
INSERT INTO cmp_solix_log
(table_name, seq_no, begin_time, end_time, cnt, err_code, err_message)
VALUES
('CMP_CREDIT_GIMAP_PUBLICNO_PROT_ERR_0', l_seq, l_start, SYSDATE, l_update_cnt, p_err_code, p_err_message);
COMMIT;
END;
/