Problème avec mon trigger
salut!
etant novice dans oracle, j'ai de problemes suivants:
voici mes tables:
Ligne_Coms (Num_Com ,Num_Pro ,Qte_Com );
Commandes (Num_Com ,Date_Com,Nbre_lc),Mtot_Com,Num_Cli)
voici mon trigger:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| CREATE TRIGGER ajoutCommande
AFTER INSERT
ON Ligne_Coms
FOR EACH ROW
BEGIN
IF (verifier_qtecom(Qte_Com,Num_Pro)) then
BEGIN
UPDATE Commandes
SET nbre_lc= nbre_lc+1 where Ligne_Coms.Num_Com=Commandes.Num_Com ;
UPDATE Commandes
SET Mtot_Com = Mtot_Com + :new.Qte_Com * Prix_U WHERE Num_Com = :new.Num_Com;
UPDATE Produits
SET qtestock = qtestock - :new.Qte_Com WHERE Num_Pro = :new.Num_Pro;
COMMIT;
END;
ELSE
BEGIN
DBMS_OUTPUT.PUT_LINE('Ajout annulé') ;
ROLLBACK;
END;
end if;
END; |
le trigger doit incrementer nbre_lc,recalculer mtot_com et soustraire qtestock pour chaque ajout d'une nouvelle ligne si la fonction verifier_qtecom(Qte_Com,Num_Pro)==true sinon l'opération d'ajout est annulée.
Voici mes questions:
1) l'execution de ce trigger me donne l'erreur suivante:
Code:
1 2
| 2/4 PL/SQL: Statement ignored
2/24 PLS-00201: l'identificateur 'QTE_COM' doit être déclaré |
. je n'arrive pas à le resoudre.
2) est ce que ce trigger respecte les regles ci-dessus?