SET TERM ^ ;

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

    HISTORICO = '';

    IF ( NEW.ID IS NOT NULL) THEN
    BEGIN
        HISTORICO = HISTORICO||'ITEM INCLUIDO: '||NEW.ID;
    END

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

SET TERM ; ^

