SET TERM ^ ;

CREATE OR ALTER trigger ttbpedido_bu_api for tbpedido
active before update position 999
AS
begin
    if(new.codigo_rastreio is distinct from old.codigo_rastreio)then
    begin
        if(updating )then execute procedure spi_integracao_api('TBPEDIDO_RATREAMENTO',new.pedido,'A');
    end

    if(new.status_ecommerce is distinct from old.status_ecommerce)then
    begin
        if(updating )then execute procedure spi_integracao_api('TBPEDIDO_STATUS',new.pedido,'A');
    end

end
^

SET TERM ; ^

