就一个简单的declare语句
DECLARE a INT;
也提示1064错误
Error Code : 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 'DECLARE a INT' at line 1为什么?我用select version();
版本是5.0.45
DECLARE a INT;
也提示1064错误
Error Code : 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 'DECLARE a INT' at line 1为什么?我用select version();
版本是5.0.45
它要放在begin..end里面,也就是在存储过程或者函数里面使用如果想使用局部变量,可以这样做
set @a=(select version());
select @a;
+-------------------------+
| @a |
+-------------------------+
| 5.0.37-community-nt-log |
+-------------------------+
1 row in set (0.00 sec)