merci d'avoir porté attention à ma question.
j'ai essayé d'écrire le trigger suivant qui permet de vérifier un stock d'aun
article donné et qui permet de le mettre à jour en fonction de la quantité livrée.
le problème est qu'il me sort les erreurs suivantes et je comprends pas pourquoi??
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 CREATE OR REPLACE TRIGGER BI_qte_livree BEFORE INSERT ON DETAILLIVRAISON FOR EACH ROW DECLARE qtestock Article.quantiteStock%type; qte ligneCommande.quantite%type; BEGIN SELECT quantiteStock INTO qtestock FROM Article WHERE noArticle = :new.noArticle; SELECT quantite INTO qte FROM ligneCommande WHERE noArticle = :new.noArticle AND noCommande = :new.noCommande; IF ( qteStock > 0 ) THEN IF( :new.quantiteLivree <= ( qte - (fQuantiteLivree(:New.noCommande,:New.noArticle) ) THEN IF( :new.quantiteLivree <= qteStock ) THEN qteStock = qteStock - :new.quantiteLivree; ELSE :new.quantiteLivree = qteStock; qteStock = 0; end if; end if; UPDATE Article SET quantiteStock = qteStock WHERE noArticle = :new.noArticle; ELSE RAISE_APPLICATION_ERROR (-20005,'quantite en stock insuffisante'); end if; END;
si quelqu'un peut m'aider à comprendre mon erreur j'en serais reconnaissant
LINE/COL ERROR
-------- -----------------------------------------------------------------
16/91 PLS-00103: Encountered the symbol "THEN" when expecting one of
the following:
) , * & | = - + < / > at in is mod remainder not rem => ..
<an exponent (**)> <> or != or ~= >= <= <> and or like
between || year DAY_ member SUBMULTISET_
18/15 PLS-00103: Encountered the symbol "=" when expecting one of the
following:
:= . ( @ % ;
19/5 PLS-00103: Encountered the symbol "ELSE"
Partager