create or replace TRIGGER APAGA_NRLANCTONF_COMPENSACAO
BEFORE DELETE
ON NOTAFISCAL FOR EACH ROW
BEGIN
   IF :OLD.NRAPURACFAT IS NOT NULL THEN
      UPDATE CTRLCOMPENSACAO 
         SET NRLANCTONF = NULL
       WHERE CDFILIAL = :OLD.CDFILIAL
         AND NRAPURACCOMP = :OLD.NRAPURACFAT
         AND NRLANCTONF = :OLD.NRLANCTONF;
   END IF;
END;
/
-- VERSAO --
BEGIN ATUVEROBJ('APAGA_NRLANCTONF_COMPENSACAO','5.87.000'); END;
/

