CREATE OR REPLACE TRIGGER EXC_DUPLICATA_PAG
AFTER UPDATE OR DELETE ON CONTAPAGAR FOR EACH ROW
BEGIN
   IF UPDATING THEN
      UPDATE NOTAFISCAL
      SET DTEXPORTACAO = NULL
      WHERE CDFILIAL = :OLD.CDFILIAL AND
            NRLANCTONF = :OLD.NRLANCTONF;
   ELSE
      UPDATE USR_CARGA_DUPLICATA
      SET TP_ATUALIZACAO = 'E'
      WHERE TX_FILIAL  = :OLD.CDFILIAL    AND
            TX_LANCNF  = :OLD.NRLANCTONF  AND
            TX_SEQLANC = :OLD.NRSEQVENPAG AND
            TX_PARCELA = :OLD.NRPARCELAPAG;
   END IF;
END;
/

-- VERSAO --
BEGIN ATUVEROBJ('EXC_DUPLICATA_PAG','4.11.033'); END;
/

