Fórum Trigger de atualização (ñ atualiza)!!!! #40787
10/12/2003
0
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
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||_
Curtir tópico
+ 0
Responder
Posts
10/12/2003
Afarias
inclua o update de contas a receber no FOR SELECT DO... com um beguin end, ex::
T+
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+
Responder
Gostei + 0
10/12/2003
_||bern||_
Deu tudo certo valeu!!!
[]´s
Bern
[]´s
Bern
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)