CREATE OR REPLACE TRIGGER DTULTATU_FOTOPRAPAD
BEFORE INSERT OR UPDATE OR DELETE
ON FOTOPRAPAD FOR EACH ROW

DECLARE
V_CDPRATO      FOTOPRAPAD.CDPRATO%TYPE;
V_CDFILAUXPRAT FOTOPRAPAD.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;
/
