Bonjour,
voilà je vous explique ce qui m'arrive. Je tente de créer un trigger dans phpMyAdmin. J'ai l'habitude d'effectuer mes requête en PL/SQL ce qui diffère légèrement. Donc voilà mon trigger :
Lorsque je l’exécute je change bien mon delimiter en $$.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 CREATE OR REPLACE TRIGGER MAJ AFTER DELETE ON table FOR EACH ROW BEGIN max NUMBER(3); SELECT MAX(id) IN max FROM table; CURSOR ids IS SELECT table.id FROM table ORDER BY DESC LIMIT OLD.id, max; id table.id%TYPE; FOR id IN ids LOOP UPDATE table SET table.id = max-1 WHERE table.id = max; END LOOP END
Voilà l'erreur qui m'est retournée :
#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 'TRIGGER MAJidArticle AFTER DELETE ON article FOR EACH ROW BEGIN ' at line 1
Toute aide serait là bienvenue
Partager