Saturday, June 4, 2022

[SOLVED] Delimeter not working, "Syntax" errors when running .sql from shell

Issue

I'm trying to make a simple stored procedure... After exploring a bit, I discover I can't make any procedure at all, not even the simplest. For exemple, running this href="https://dev.mysql.com/doc/refman/8.0/en/stored-programs-defining.html" rel="nofollow noreferrer">specific procedure from the documentation:

DELIMETER ;
DROP PORCEDURE IF EXISTS sp_dorepeat
DELIMETER //
CREATE PROCEDURE sp_dorepeat(p1 INT)
BEGIN
    SET @x = 0;
    REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
END //
DELIMETER ;

Gives me the following error: pain

Which is basically the same syntax error on every line. Changing the $$ for // also doesn't have any effect, as suggested here.

It's worth knowing that I'm running the shell as root, so there are no restrictions. Is there anything wrong with my code? The database is mysql 8.0


Solution

Of course you can , but with the right keywords

DELIMETER -> DELIMITER

PORCEDURE -> PROCEDURE



Answered By - Dri372
Answer Checked By - Marilyn (WPSolving Volunteer)