J'utilise MySQL v5.1.36 et j'essaye de créer une fonction stockée en utilisant ce code. Lorsque vous entrez dans la console MySQL, j'obtiens cette réponse.Erreurs avec la création de la fonction MySQL stockée ERROR 1064 & 1327
mysql> DELIMITER //
mysql> CREATE FUNCTION `modx`.getSTID (x VARCHAR(255)) RETURNS INT DETERMINISTIC
-> BEGIN
-> DECLARE y INT;
ERROR 1064 (42000): 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 3
mysql> SELECT id INTO y
-> FROM `modx`.coverage_state
-> WHERE `coverage_state`.name = x;
ERROR 1327 (42000): Undeclared variable: y
mysql> RETURN y;
ERROR 1064 (42000): 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 'RETUR
N y' at line 1
mysql> END//
D'après ce que je peux trouver en ligne ma syntaxe est correcte. Qu'est-ce que je fais mal?
Ah, j'ai manqué cela quand j'ai attrapé l'information hors de la console. Je vais corriger cela dans la question. –