我正在尝试在MYSQL 5.6.13中创建一个简单的存储过程
create procedure create_logger_id(IN mobile BIGINT)
BEGIN
SELECT COUNT(*) INTO mobile FROM USER_REG_TYPE;
END
但是出现此错误: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 '' at line 3
我什至尝试了delimiter //
,DECLARE mobile INT
,其他几个都导致了相同的错误。
MYSQL服务器托管在AWS RDS上(添加了此信息以了解是否存在已知问题)
更新: 如果我尝试
DELIMITER //;
CREATE PROCEDURE create_logger_id(IN mobile BIGINT)
BEGIN
SELECT COUNT(*) INTO mobile FROM USER_REG_TYPE;
END //
DELIMITER ;
我收到以下错误
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 'DELIMITER //' at line 1
答案 0 :(得分:0)
您需要添加一个定界符。
DELIMITER //
CREATE PROCEDURE create_logger_id(IN mobile BIGINT)
BEGIN
SELECT COUNT(*) INTO mobile FROM USER_REG_TYPE;
END //
DELIMITER ;
我想鼓励您阅读更多有关定界符的信息:Delimiters in MySQL