CREATE OR ALTER trigger ttbpdv_cfe_b01d for tbpdv_cfe
active before delete position 1
AS

DECLARE VARIABLE CAIXA_ID INTEGER;
BEGIN
    IF(OLD.SITUACAO <> 1) THEN
    BEGIN
        IF(OLD.SITUACAO = 2) THEN EXCEPTION "..."'CUPOM FISCAL AUTORIZADO. EXCLUSAO CANCELADA';

        IF(OLD.SITUACAO = 3) THEN EXCEPTION "..."'CUPOM FISCAL CANCELADO. EXCLUSAO CANCELADA';

    END
END;