-- Customer specific once-script WEHK#31644.
--
-- (c) 2015 Facilitor bv
-- $Revision$
-- $Id$
--
-- Support: +31 53 4800700
SET ECHO ON
SPOOL xWEHK#31644.lst
SET DEFINE OFF;


DECLARE
   CURSOR c
   IS
      SELECT idsc.ins_deelsrtcontrole_key
        FROM ins_deelsrtcontrole idsc
       WHERE idsc.ins_deelsrtcontrole_datum_org = fac.nextcyclusdate (idsc.ins_deel_key, idsc.ins_srtcontrole_key, 1);
BEGIN
   FOR r1 IN c
   LOOP
      BEGIN
         DELETE FROM ins_deelsrtcontrole idsc
               WHERE idsc.ins_deelsrtcontrole_key = r1.ins_deelsrtcontrole_key;
      END;
   END LOOP;
END;
/


COMMIT;
SPOOL OFF;
