MySQL Forums
Forum List  »  General

syntax error on simple while loop
Posted by: Paul Walker
Date: April 02, 2010 10:21AM

Why is it that I cannot execute this simple WHILE loop statement?

SET @a = 5;
WHILE @a > 0 DO
SET @a = @a - 1;
SELECT @a;
END WHILE;

I was able to create a procedure with a while loop, but the above tells me I have an error in my SQL syntax when simply trying to execute directly. I am using MySQL 5.1.42.

Options: ReplyQuote


Subject
Written By
Posted
syntax error on simple while loop
April 02, 2010 10:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.