views:

47

answers:

0

Hello All. 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