URGENT:Problem with variable in a trigger [message #1680] |
Wed, 22 May 2002 00:43 |
JoJo
Messages: 18 Registered: January 2002
|
Junior Member |
|
|
I have a little problem and as far as i am a newbie,i can t understand why it doesnt work.
see the code below:
*****************************************
quan1maj := :NEW.CODZN10 - (quantitecommandée * (poidsnet-poids));
quan2maj := (quan1maj / quantitecommandée);
UPDATE EVL SET EVL.QTESUP1 = quan1maj,EVL.QTESUP2 = quan2maj
WHERE EVL.CODSOC = 999 /*for testing*/
AND EVL.ACHVTE = :NEW.ACHVTE
AND EVL.NUMEVE = :NEW.NUMEVE
AND EVL.TYPEVE = :NEW.TYPEVE
AND EVL.NUMPOS = 1;
ratio := quan2maj / quan2dedepart;
prixvdudarrivee := prixvdudedepart * ratio;
prixbrutdarrivee := prixbrutdedepart * ratio;
prixtavdarrivee := prixtavdedepart * ratio;
UPDATE EVP SET EVP.PRXVDU = prixvdudarrivee,EVP.PRXBRT = prixbrutdarrivee,EVP.PRXTAV = prixtavdarrivee
WHERE EVP.CODSOC = 999 /*for testing*/
AND EVP.ACHVTE = :NEW.ACHVTE
AND EVP.TYPEVE = :NEW.TYPEVE
AND EVP.NUMEVE = :NEW.NUMEVE
AND EVP.NUMPOS = 1;
The update on table EVL works fine but nothing appends on EVP. IF i put the update code for EVP before EVL,EVL works fine again but EVP still doesn t work.
All variables are declared as number.
i ve search and discover that all computed variables seem to "disappear" as soon as i m using them.
My question is : how can i manage to keep the variable instanciated with what i want during all the PL/SQL execution??please help me!!
|
|
|
|
Re: URGENT:Problem with variable in a trigger [message #1715 is a reply to message #1705] |
Thu, 23 May 2002 23:38 |
JoJo
Messages: 18 Registered: January 2002
|
Junior Member |
|
|
Thank you for your help pavani.It might be useful but i have discovered my real problem.
May be you can help me:
the requests work fine,all the problem is that it is a for each row trigger,and i don t want him to fire for each row :),i want him to fire only when the row meet my needs,take an example: If first and second row are updated,the trigger fires on first and second row,but if i want him to fire only on second row,what can i do.
If,for instance,the first row had a numcode = 0 and the second row have a numcode = 1,i thought i might put a statement like (if numcod <> 0 ) then "execution",but it doesn t work.The trigger stops firing.I don t know how to tell the trigger
to skip a row if it doesn t meet my needs.
Ok thanks for the help.
take care.
|
|
|