[firebase-br] Trigger x Select II ... Roger 21/04/06

RedDevil reddevil_fdb em yahoo.com.br
Sex Abr 21 19:44:30 -03 2006


ola Roger,


deixe a tua Trigger como estou colocando ae abaixo que entao ela vai
funcionar... eu creio que era o teu "active after update" que estava zoando
a Trigger, pois eu testei com "active before ..." e funcionou legal...


CREATE TRIGGER REQUISICOES_AU0 FOR REQUISICOES
active before insert ou update position 0
AS
 declare variable nparcelas integer;
begin
    select c.cnd_parcelas
     from condicoes c where c.cnd_id = new.cnd_id
      into nparcelas;

    if (new.req_valorrecebido > 0) then
    begin
     >>>> parcelas nunca recebe um valor <<<<<
     new.parcelas = nparcelas;
     ...
    end
...
end


[]s
força sempre!!!
ate +++

--
Luiz "RedDevil" Stefanski - Linux User #399026
http://www.RedDevil.eti.br - Delphi 4 Powered by IBObjects
exemplos e dicas sobre o IBObjects:
http://www.RedDevil.eti.br/ibob.htm
usando o IBExpert no Linux:
http://www.firebase.com.br/fb/artigo.php?id=1366



----- Original Message -----
From: "Roger" <roger em dgpram.com.br>
To: "FireBase" <lista em firebase.com.br>
Sent: Friday, April 21, 2006 2:50 PM
Subject: [firebase-br] Trigger x Select II ... Roger 21/04/06


Olá Pessoal, boa tarde !!

Não obtive qualquer resposta a mensagem anterior,
então estou tentado reformular a pergunta,
pois não sei se havia sido claro o suficiente.

Numa Trigger, por que não teria acesso ao valor de uma variável
´alimentada´ por um select, como no exemplo abaixo ?

Maneira 1:

CREATE TRIGGER REQUISICOES_AU0 FOR REQUISICOES
ACTIVE AFTER UPDATE POSITION 0
AS
 declare variable nparcelas integer;
begin
    select c.cnd_parcelas
     from condicoes c where c.cnd_id = new.cnd_id
      into nparcelas;

    if (new.req_valorrecebido > 0) then
    begin
     >>>> parcelas nunca recebe um valor <<<<<
     new.parcelas = nparcelas;
     ...
    end
...
end

SE FIZER DESTA OUTRA MANEIRA, FUNCIONA !!!

Maneira 2:

CREATE TRIGGER REQUISICOES_AU0 FOR REQUISICOES
ACTIVE AFTER UPDATE POSITION 0
AS
 declare variable nparcelas integer;
begin

    if (new.req_valorrecebido > 0) then
    begin
     select c.cnd_parcelas
      from condicoes c where c.cnd_id = new.cnd_id
       into nparcelas;
     >>>> aqui parcelas recebe um valor <<<<<
     new.parcelas = nparcelas;
     ...
    end
...
end

ALGUÉM SABERIA ME INFORMAR ONDE ESTOU ERRANDO ??


Obrigado

[]´s Roger



		
_______________________________________________________ 
Abra sua conta no Yahoo! Mail: 1GB de espaço, alertas de e-mail no celular e anti-spam realmente eficaz. 
http://br.info.mail.yahoo.com/





Mais detalhes sobre a lista de discussão lista