CREATE PROCEDURE test ()
BEGIN
update vmc_preselling_activity SET last_modify = now() WHERE activity_id = '18';
END;
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 'END' at line 1
指导指导?
推测是因为mysql默认的定界符是【;】,所以编译器读语句到第一个【;】就视为BEGIN部分的结束,而没有匹配到END。
一个方法是在CREATE之前先把默认的定界符换一个,例如
DELIMITER // ;
然后再把END;改为END//。
最后再把定界符换回来:
DELIMITER ; //