存储过程代码:
CREATE PROCEDURE so(IN mov char(255),IN p1 int,IN p2 int)
BEGIN
SET @sql = CONCAT('SELECT * FROM filedata where title like (%',mov,'%) order by dateandtime desc LIMIT ',p1,',',p2,'');
PREPARE sqlstmt FROM @sql;
EXECUTE sqlstmt;
DEALLOCATE PREPARE sqlstmt;
END$$当我调用这个存储过程call so('nba','1','2');,MYSQL提示出错:ERROR 1064 (42000): 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 '%nba%) order by dateandtime desc LIMIT 1,2' at line 1希望各位高手能给指点下迷津,小弟不胜感激!
CREATE PROCEDURE so(IN mov char(255),IN p1 int,IN p2 int)
BEGIN
SET @sql = CONCAT('SELECT * FROM filedata where title like (%',mov,'%) order by dateandtime desc LIMIT ',p1,',',p2,'');
PREPARE sqlstmt FROM @sql;
EXECUTE sqlstmt;
DEALLOCATE PREPARE sqlstmt;
END$$当我调用这个存储过程call so('nba','1','2');,MYSQL提示出错:ERROR 1064 (42000): 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 '%nba%) order by dateandtime desc LIMIT 1,2' at line 1希望各位高手能给指点下迷津,小弟不胜感激!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货