当前位置: 代码迷 >> Sql Server >> Mysql 中的declare,该怎么解决
  详细解决方案

Mysql 中的declare,该怎么解决

热度:24   发布时间:2016-04-27 12:33:06.0
Mysql 中的declare
我想通过一个循环输入一条select语句中的所有记录
declare i int;
set i=150;
while i<=200 DO
BEGIN
select dutyid from hst_cashserial where [email protected];
set i=i++;
end;


运行后报错:
[SQL] declare i int;
[Err] 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 i int' at line 1

MYSQL的版本是4.0 网上翻了翻,语法应该没错误呀、难道是MYSQL4.0 不支持?吐血

------解决方案--------------------
建议去MYSQL问问
------解决方案--------------------
[email protected]
SQL code
declare i int;--改成declare @i intset i=150;[email protected]=150while i<=200 DO --改成while @i<200 doBEGINselect dutyid from hst_cashserial where [email protected];set i=i++; --改成set @[email protected]+1end;
  相关解决方案