Reputation: 33
It's a simple procedure, I just cannot for the life of me find the error in this syntax. I've learned at other posts and couldn't find a working solution.
CREATE PROCEDURE cooldownUpdate @command VARCHAR(18)
AS
UPDATE `mention_cooldowns` SET cooldown = 'true' WHERE command = @command
GO;
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 '
@command VARCHAR(18) AS UPDATE mention_cooldowns SET cooldown = 'true' WHERE c
' at line 1
Upvotes: 0
Views: 144
Reputation: 164
Firstly, you have to set a delimiter while creating stored procedure. Also, you have to define whether the parameter is for IN
or OUT
and finally you have to wrap your queries inside BEGIN
and END
for best practice.
Please check below for creating stored procedure.
DELIMITER //
CREATE PROCEDURE cooldownUpdate(IN pCommand VARCHAR(18))
BEGIN
UPDATE `mention_cooldowns` SET cooldown = 'true' WHERE command = pCommand;
END //
DELIMITER ;
Upvotes: 1