[firebase-br] Update With Lock

Auriston Lopes auristonlopes em gmail.com
Dom Jun 4 21:15:37 -03 2017


Boa Noite.



Na Trigger abaixo, vocês poderiam me ajudar a fazer um lock no update ?

Estou tendo Dead Lock na tabela 085



Observação:

 A procedure atualizaestoque  retorna o saldo atual do item(entrada-saida)



CREATE OR ALTER TRIGGER TBL085_AIUD0 FOR TBL085

ACTIVE AFTER INSERT OR UPDATE OR DELETE POSITION 0

AS

  declare variable Saldof Numeric(15,4);

begin

   if (inserting) then

      begin

         execute procedure atualizaestoque(new.ID_001, 1) returning_values
Saldof;

          update produtos set saldo_est = :Saldof where (codigo =
new.ID_001);

      end

   else if (updating) then

      begin

         if (new.OK = 'S') then

            Begin

               execute procedure atualizaestoque(new.ID_001, 1)
returning_values Saldof;

               update produtos set saldo_est = :Saldof where (codigo =
new.ID_001);

            End

      end

   else if (deleting) then

      begin

          execute procedure atualizaestoque(old.ID_001, 1) returning_values
Saldof;

          update produtos set saldo_est = :Saldof where (codigo =
old.ID_001);

      end

end

^





SET TERM ; ^



Mais detalhes sobre a lista de discussão lista