希望这是一个很好的快速解决方案。
这是我的 .sql 文件:
USE my_db;
DELIMITER $$
CREATE PROCEDURE searchLocation(IN argQuery VARCHAR(32), IN argLimit INT)
BEGIN
SELECT DISTINCT `suburb`, `postcode`
FROM `location`
WHERE `suburb` LIKE '%argQuery%'
OR `postcode` LIKE 'argQuery%'
LIMIT argLimit
;
END
$$
DELIMITER ;
这是输出:
ERROR 1064 (42000) at line 4: 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 'argLimit
;
END' at line 8
所以它似乎不喜欢我的参数 argLimit,但我不知道为什么。我一定是在做傻事。
我正在使用 MySQL 5.0.51。
谢谢。