CREATE OR REPLACE TRIGGER DTULTATU_PRATTPCARD
BEFORE INSERT OR UPDATE OR DELETE
ON PRATTPCARD FOR EACH ROW

DECLARE
V_CDPRATO      PRATTPCARD.CDPRATO%TYPE;
V_CDFILAUXPRAT PRATTPCARD.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
      DTULTATUPRAT = SYSDATE
   WHERE
      (CDPRATO      = V_CDPRATO) AND
      (CDFILAUXPRAT = V_CDFILAUXPRAT);
END;
/
