MysSql : creation de trigger

Résolu
mictif Messages postés 105 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 14 février 2013 - 24 juil. 2009 à 09:47
mictif Messages postés 105 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 14 février 2013 - 24 juil. 2009 à 15:21
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:
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 :
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.

1 réponse

mictif Messages postés 105 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 14 février 2013 2
24 juil. 2009 à 15:21
J'ai trouvé :
manque : delimiter ;; au debut
et aussi je devais etre en root pour que cela fonctionne :p
merci ! hihi
3
Rejoignez-nous