[英]MySQL Stored Procedure erro
我收到此错误
#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 'lstart, lend; END IF; ELSE IF lstart = -1 THEN select count(*) a' at line 8"
在服务器上的此存储过程创建上,但是在我的本地主机phpmyadmin中创建时没有任何错误?
DELIMITER
create procedure getallmedia(IN cat int(2), IN asc_desc varchar(5), IN lstart int(11), IN lend int(11))
BEGIN
IF cat = -1 THEN
IF asc_desc = 'asc' THEN
IF lstart = -1 THEN
select count(*) as result from bc_media where id <> -1;
ELSE
select * from bc_media where id <> -1 limit lstart, lend;
END IF;
ELSE
IF lstart = -1 THEN
select count(*) as result from bc_media where category = cat;
ELSE
select * from bc_media where category = cat order by id desc limit lstart, lend;
END IF;
END IF;
ELSE
IF asc_desc = 'asc' THEN
IF lstart = -1 THEN
select count(*) as result from bc_media where category = cat;
ELSE
select * from bc_media where category = cat limit lstart, lend;
END IF;
ELSE
IF lstart = -1 THEN
select count(*) as result from bc_media where category = cat;
ELSE
select * from bc_media where category = cat order by id desc limit lstart, lend;
END IF;
END IF;
END IF;
END
DELIMITER ;
请帮帮我:(
我不确定,但是在第一次DELIMITER时尝试放入$$
在最后一个END之后放$$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.