I'm trying to create a trigger on a table after inserting, which gonna update another table.
this is the code I tried :
delimiter |
CREATE TRIGGER augmenter_quantite_article AFTER INSERT
ON LigneInterventaire
FOR EACH ROW BEGIN
DECLARE @qte AS INTEGER;
DECLARE @code AS INTEGER;
SELECT @qte = qteInv FROM INSERTED;
SELECT @code = codeArt FROM INSERTED;
UPDATE Article SET qteArt = qteArt + @qte WHERE codeArt = @code;
END;
|
delimiter ;
but I get this error message :
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@qte AS INTEGER; DECLARE @code AS INTEGER; SELECT @qte = qteInv FROM INSERTED; S' at line 4
:=instead of=