probleme de syntaxe avec trigger
Bonjour,
j'ai un problème avec la syntaxe de mes trigger.
Mon trigger est accepté comme ceci par le moteur mysql
Code:
1 2 3 4 5 6
| CREATE TRIGGER `trigger_update_searchText` AFTER UPDATE ON `annonce`
FOR EACH ROW
UPDATE search_text SET data=CONCAT_WS(' ',NEW.Sujet,NEW.SujetNL,NEW.Contenu,NEW.ContenuNL),Actif=NEW.Actif,DateUpdated=NOW()
WHERE model = 'annonce' and Ref_Model = NEW.Ref |
et quand je l'introduit comme ceci il n'en veut pas, quelqu'un peut m'aider
Code:
1 2 3 4 5 6
| CREATE TRIGGER `trigger_update_searchText` AFTER UPDATE ON `annonce`
FOR EACH ROW BEGIN
IF NEW.hit = OLD.hit THEN
UPDATE search_text SET data=CONCAT_WS(' ',NEW.Sujet,NEW.SujetNL,NEW.Contenu,NEW.ContenuNL),Actif=NEW.Actif,DateUpdated=NOW() WHERE model = 'annonce' and Ref_Model = NEW.Ref;
END IF;
END; |
Et j'ai essayé pas mal de combinaison, pas moyen...
Merci d'avance