CREATE OR REPLACE TRIGGER DTULTATU_PREPPRAFIL
BEFORE INSERT OR UPDATE OR DELETE
ON PREPPRAFIL FOR EACH ROW

DECLARE
V_CDPRATO      PREPPRAFIL.CDPRATO%TYPE;
V_CDFILAUXPRAT PREPPRAFIL.CDFILAUXPRAT%TYPE;

BEGIN
   IF DELETING THEN
      V_CDPRATO      := :OLD.CDPRATO;
      V_CDFILAUXPRAT := :OLD.CDFILAUXPRAT;
   ELSE
      V_CDPRATO      := :NEW.CDPRATO;
      V_CDFILAUXPRAT := :NEW.CDFILAUXPRAT;
   END IF;

   UPDATE
      PRATO
   SET
      DTULTATURECE = SYSDATE
   WHERE
      (CDPRATO      = V_CDPRATO) AND
      (CDFILAUXPRAT = V_CDFILAUXPRAT);
END;
/