存储过程:
?
CREATE PROCEDURE `ClearCoupon`() BEGIN declare today int(16); select UNIX_TIMESTAMP(curdate()) into today; UPDATE coupon SET status=0 WHERE endtime<today; END;
?
?copy到phpmyadmin里面执行,就报错了
SQL 查询: CREATE?PROCEDURE?`ClearCoupon`?(?)?BEGIN?declare?today?INT(?16?)?; MySQL 返回:
错误
#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 '' at line 3?
解决办法:
存储过程的语法是没错的,出问题的是 语句界定符";"
只需要把phpmyadmin的sql输入框下面的 "语句界定符"改为"//"就OK了
?