CREATE PROCEDURE dorepeat(IN p1 INT)
BEGIN
DECLARE x INT DEFAULT 0;
REPEAT SET x = x + 1; UNTIL x > p1 END REPEAT;
END
I get an syntax error
Remove the DECLARE, you should be able to just do this:
SET @x = 0;
Also, variables need to be prefixed with the @ symbol
You need to temporarily change the delimiter so the MySQL client doesn't think you're done with your statement when it sees the semicolon on line 3:
DELIMITER //
CREATE PROCEDURE dorepeat(IN p1 INT)
BEGIN
DECLARE x INT DEFAULT 0;
REPEAT SET x = x + 1; UNTIL x > p1 END REPEAT;
END//
DELIMITER ;