--Author: Venkata Potluri
--Date: May 19, 2015

DECLARE
   TYPE T_IRBN IS TABLE OF SIEBEL.EIM_LOY_TXN.IF_ROW_BATCH_NUM%TYPE;

   ARR_IRBN   T_IRBN;

   CURSOR C1
   IS
      SELECT DISTINCT IF_ROW_BATCH_NUM
        FROM SIEBEL.EIM_LOY_TXN
       WHERE IF_ROW_BATCH_NUM BETWEEN 6001 AND 7000;
BEGIN
   OPEN C1;

   LOOP
      FETCH C1 BULK COLLECT INTO ARR_IRBN LIMIT 1;

      FORALL ROW IN ARR_IRBN.FIRST .. ARR_IRBN.LAST
         DELETE FROM SIEBEL.EIM_LOY_TXN
               WHERE IF_ROW_BATCH_NUM = ARR_IRBN (ROW);

      COMMIT;

      EXIT WHEN C1%NOTFOUND;
   END LOOP;

   CLOSE C1;
END;
/

QUIT