MySQL Forums
Forum List  »  Newbie

SQL Insert error with variables
Posted by: Ricardo Gamarra
Date: August 18, 2014 10:31AM

Could someone tell me please wich part of this code is making trouble in my phpMyAdmin tool?


SET @Capitulo = 1;

CREATE TEMPORARY TABLE Temp (Capitulo INT);

WHILE @Capitulo < 10 DO
INSERT INTO Temp VALUES (@Capitulo);

SET @Capitulo = @Capitulo + 1;
END WHILE;

SELECT * FROM Temp



The error:
#1064 - 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 'WHILE @Capitulo < 10 DO
INSERT INTO Temp VALUES (@Capitulo)' at line 1

Options: ReplyQuote


Subject
Written By
Posted
SQL Insert error with variables
August 18, 2014 10:31AM


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.