如何在我的MySQL游标代码中调试语法错误?

| 我的光标代码有错误:
delimiter//
CREATE FUNCTION updateOrder()
DETERMINISTIC
BEGIN
DECLARE done INT DEFAULT 0;
# déclare les variables qui vont accueillir les données retournées par la requête
DECLARE i_id_produit INTEGER;
DECLARE old_id_produit INTEGER;
DECLARE cpt INTEGER;
# déclare le curseur
DECLARE ccustomers CURSOR FOR SELECT id_produit
FROM produit_documentation order by id_produit;
# déclare un handler pour détecter la fin du jeu d\'enregistrements
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
# ouvre le curseur
OPEN ccustomers;
REPEAT
FETCH ccustomers INTO i_id_produit;
IF i_id_produit = old_customer_id THEN
UPDATE produit_documentation SET ordre = cpt;
cpt++;
ELSE old_customer_id = i_id_produit;
END IF;
UNTIL done END REPEAT;
END
//
我收到此错误:
Script line: 2  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 
\'DETERMINISTIC
BEGIN
DECLARE done INT DEFAULT 0;
# déclare les variables qui \' at line 2
我使用MySQL 5.5。     
已邀请:
CREATE FUNCTION
之后需要一个
RETURNS
子句,如下所示:
DELIMITER //
CREATE FUNCTION updateOrder() RETURNS varchar(255)
DETERMINISTIC
...
有关详情,请参见此。 不要忘记添加匹配的
RETURN
语句,并在最后将定界符设置回
;
。 :) 预计到达时间:或改为
PROCEDURE
,如本例所示。     

要回复问题请先登录注册