Trigger de atualização (ñ atualiza)!!!!

Firebird

10/12/2003

Estou com a seguinte trigger e ela nao esta atualizando a table contas_receber so atualiza a lancamentos!! o que pode ser???


CREATE TRIGGER LANCAMENTOS_AI0 FOR LANCAMENTOS
ACTIVE AFTER INSERT POSITION 0
AS
declare Variable conta_receber Integer;
begin

for select id_conta_receber from contas_receber
where (ID_SOCIO = NEW.id_socio) and (Situacao=´A´)
into :conta_receber do
UPDATE lancamentos SET
lancamentos.id_conta_receber = :conta_receber
WHERE id_lancamento = NEW.id_lancamento;



UPDATE contas_receber SET
contas_receber.valor_total = contas_receber.valor_total + New.valor_total
WHERE id_Conta_receber = :conta_receber;


end


_||bern||_

_||bern||_

Curtidas 0

Respostas

Afarias

Afarias

10/12/2003

inclua o update de contas a receber no FOR SELECT DO... com um beguin end, ex::


for select id_conta_receber from contas_receber 
  where (ID_SOCIO = NEW.id_socio) and (Situacao=´A´) 
  into :conta_receber do 
begin

  UPDATE lancamentos 
  SET lancamentos.id_conta_receber = :conta_receber 
  WHERE id_lancamento = NEW.id_lancamento; 

  UPDATE contas_receber 
  SET contas_receber.valor_total = contas_receber.valor_total + New.valor_total 
  WHERE id_Conta_receber = :conta_receber; 

end




T+


GOSTEI 0
_||bern||_

_||bern||_

10/12/2003

Deu tudo certo valeu!!!

[]´s

Bern


GOSTEI 0
POSTAR