Trigger de atualização (ñ atualiza)!!!!
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||_
Curtidas 0
Respostas
Afarias
10/12/2003
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+
GOSTEI 0
_||bern||_
10/12/2003
Deu tudo certo valeu!!!
[]´s
Bern
[]´s
Bern
GOSTEI 0