SET TERM ^ ;

CREATE trigger ttbprogramacao_b17u for tbprogramacao
active before update position 15
AS
begin

  if(new.ferramenta_id > 0 and old.ferramenta_id > 0 and new.ferramenta_id is distinct from old.ferramenta_id)then
  begin
      EXECUTE PROCEDURE SPI_HISTORICO('TBREMESSA',NEW.remessa_id, 'Talao: '||new.tabela_id||' Ferramenta: '||old.ferramenta_id||' -> '||new.ferramenta_id);
  end

end
^

SET TERM ; ^

