mysql create procedure syntax issue line 1

懵懂的女人 提交于 2019-12-13 19:55:14

问题


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

回答1:


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!



来源:https://stackoverflow.com/questions/3356929/mysql-create-procedure-syntax-issue-line-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!