mysql 创建过程语法问题第 1 行
我在以下过程的第 1 行收到语法错误:
DELIMITER |
CREATE PROCEDURE sp_autocallFillCallQueue
BEGIN
DECLARE maxCalls TINYINT(1);
SELECT autocall_maxCalls INTO maxCalls FROM `options` LIMIT 0,1;
REPEAT
INSERT INTO `callQueue` (`phoneNumber`, 'waiting')
SELECT `phoneNumber` FROM `phoneNumbers` WHERE `accessRestriction` != 'blacklist' && `flagAutocall` = 1;
SET maxCalls = maxCalls - 1;
UNTIL maxCalls = 0
END REPEAT;
END;
|
我在此之前和之后设置分隔符。我有一种感觉,这很愚蠢(因为这是我的第一个 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 'PROCEDURE sp_autocallFillCallQueue
BEGIN
DECLARE @maxCalls TINYINT(1);
SELECT ' at line 1
I get a syntax error on line 1 of the following procedure:
DELIMITER |
CREATE PROCEDURE sp_autocallFillCallQueue
BEGIN
DECLARE maxCalls TINYINT(1);
SELECT autocall_maxCalls INTO maxCalls FROM `options` LIMIT 0,1;
REPEAT
INSERT INTO `callQueue` (`phoneNumber`, 'waiting')
SELECT `phoneNumber` FROM `phoneNumbers` WHERE `accessRestriction` != 'blacklist' && `flagAutocall` = 1;
SET maxCalls = maxCalls - 1;
UNTIL maxCalls = 0
END REPEAT;
END;
|
I am setting the delimiter before and after this. I have a feeling it is something silly (as this is my first mysql stored proc). I'm totally stumped atm though.
FYI, this is the error:
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 'PROCEDURE sp_autocallFillCallQueue
BEGIN
DECLARE @maxCalls TINYINT(1);
SELECT ' at line 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了将其从“未答复”列表中删除...
预测:您正在使用版本 4.1,但存储过程直到版本 5.0 才可用。
问题解决了!
In order to remove this from the "unanswered" list...
Prediction: You are using version 4.1, but stored procedures didn't become available until version 5.0.
Problem solved!