无法在MySQL5.6.13中创建存储过程

p4rjhz4m  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(359)

我试图在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
mtb9vblg

mtb9vblg1#

您需要添加分隔符。

DELIMITER //
CREATE PROCEDURE create_logger_id(IN mobile BIGINT)
BEGIN
  SELECT COUNT(*) INTO mobile FROM USER_REG_TYPE;
END //
DELIMITER ;

我鼓励您阅读更多关于分隔符的内容:mysql中的分隔符

相关问题