Bonjour,
Je débute avec MySql et j'aimerais créer 3 trigger plutôt simples.
mais je n'y arrive pas, j'ai un probleme e syntaxe. je voie des exemple avec des "delimiter" mais je ne sais pas ce que cela est.
je vous copie/colle mon script de création des trigger ainsi que les erreurs qui en decoule.
Script:
Code :

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
34
35
36
37
38
39
40
 
CREATE TRIGGER TRIG_MAJ_PTS_INSERT AFTER INSERT ON T_REACT FOR EACH ROW BEGIN
 
     UPDATE T_INDIV
 
     SET NB_POINTS = (SELECT SUM(NB_POINTS) FROM T_REACT WHERE COD_USER = NEW.COD_USER)
 
      WHERE COD_USER = NEW.COD_USER;
 
END;
 
 
 
 
 
 
 
CREATE TRIGGER TRIG_MAJ_PTS_DELETE AFTER DELETE ON T_REACT FOR EACH ROW BEGIN
 
     UPDATE T_INDIV
 
     SET NB_POINTS = (SELECT SUM(NB_POINTS) FROM T_REACT WHERE COD_USER = OLD.COD_USER)
 
      WHERE COD_USER = OLD.COD_USER;
 
END;
 
 
 
 
 
CREATE TRIGGER TRIG_MAJ_PTS_UPDATE AFTER UPDATE ON T_REACT FOR EACH ROW BEGIN
 
     UPDATE T_INDIV
 
     SET NB_POINTS = (SELECT SUM(NB_POINTS) FROM T_REACT WHERE COD_USER = OLD.COD_USER)
 
      WHERE COD_USER = OLD.COD_USER;
 
END;

Erreurs :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
Script line: 1 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 '' at line 4
Script line: 5 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 'END' at line 1
Script line: 9 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 '' at line 4
Script line: 13 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 'END' at line 1
Script line: 17 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 '' at line 4
Script line: 21 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 'END' at line 1
Merci de votre aide.