BEGIN
   FOR C IN
      (SELECT CDFILIAL, NRRETEST, DTRETEST, DSRETEST, CDFILIALLAN,
              NRLANCESTQ, CDSETOR, CDCENTCUST, NRORDPROD, NRSUBORDPROD,
              CDETAPAPROD, NRREQUESTO, IDPESPRODRET
       FROM RETIRADAESTO
       WHERE TRUNC(DTRETEST) = TO_DATE('06/01/2007','DD/MM/YYYY')
         AND NRORDPROD IS NOT NULL)
   LOOP
      UPDATE RETIRADAESTO
      SET DTRETEST = TO_DATE('02/01/2007','DD/MM/YYYY')
      WHERE CDFILIAL = C.CDFILIAL
        AND NRRETEST = C.NRRETEST;

      UPDATE ITEMRETIEST
      SET DTRETPROD = TO_DATE('02/01/2007','DD/MM/YYYY')
      WHERE CDFILIAL = C.CDFILIAL
        AND NRRETEST = C.NRRETEST;

      UPDATE LOTITRETIEST
      SET DTLANCRETDEV = TO_DATE('02/01/2007','DD/MM/YYYY')
      WHERE CDFILIAL = C.CDFILIAL
        AND NRRETEST = C.NRRETEST;

      UPDATE ITLANCTOEST
      SET DTLANCMOVI = TO_DATE('02/01/2007','DD/MM/YYYY')
      WHERE CDFILIAL = C.CDFILIALLAN
        AND NRLANCESTQ = C.NRLANCESTQ;

      UPDATE LANCTOESTOQ
      SET DTLANCESTQ = TO_DATE('02/01/2007','DD/MM/YYYY')
      WHERE CDFILIAL = C.CDFILIALLAN
        AND NRLANCESTQ = C.NRLANCESTQ;

      COMMIT;
   END LOOP;
END;
/

