我的语句如下:
CREATE PROCEDURE showdb( v_offset int, v_pagesize int )
SELECT * FROM 'comment' ORDER BY id DESC LIMIT v_offset , v_pagesize;但是提示:
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 ''comment' ORDER BY id DESC LIMIT v_offset , v_pagesize' at line
(0 ms taken)请问是什么问题呢?
谢谢!
CREATE PROCEDURE showdb( v_offset int, v_pagesize int )
SELECT * FROM 'comment' ORDER BY id DESC LIMIT v_offset , v_pagesize;但是提示:
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 ''comment' ORDER BY id DESC LIMIT v_offset , v_pagesize' at line
(0 ms taken)请问是什么问题呢?
谢谢!
DELIMITER ||
CREATE PROCEDURE showdb( v_offset int, v_pagesize int )
BEGIN
SET @stmt = concat("SELECT * FROM `comment` ORDER BY id DESC LIMIT ",v_offset,",",v_pagesize);
PREPARE s1 FROM @stmt;
EXECUTE s1;
DEALLOCATE PREPARE s1;
END||
DELIMITER ;(0 row(s)affected)
(0 ms taken)