SET TERM ^ ;

CREATE trigger ttbpdv_pagamento_condicao_b01d for tbpdv_pagamento_condicao
active before delete position 0
AS
DECLARE VARIABLE HISTORICO VARCHAR(500);
BEGIN

    HISTORICO = '';

    IF ( OLD.ID > 0) THEN
    BEGIN
        HISTORICO = HISTORICO||'ITEM EXCLUIDO: '||OLD.ID;
    END

    IF (HISTORICO <> '') THEN
    BEGIN
        EXECUTE PROCEDURE SPI_HISTORICO('TBPDV',OLD.ID, HISTORICO);
    END
end
^

SET TERM ; ^

