我得到了这个错误
#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 ;请帮帮我:
发布于 2014-03-08 01:09:24
我不确定,但是,在first DELIMITER尝试将$$
在最后一个结束后,把$$
https://stackoverflow.com/questions/22154616
复制相似问题