MySQL Forums
Forum List  »  French

procédure et variable
Posted by: boutdechoux 85
Date: July 22, 2010 08:42AM

Bonjour,

je cherche à faire quelque chose de tout simple et pourtant...

Voilà mon code :
CREATE PROCEDURE `test2`( nb int )
BEGIN
SET @limitsql = nb;
SELECT * FROM message LIMIT @limitsql;
END


en fait je veux pouvoir passer des variables à mon select et la impossible. J'ai le message
#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 '@limitsql;
END' at line 4


si je fais
CREATE PROCEDURE `test3`( nbpush int )
BEGIN
SET @limitsql = nbpush;
SELECT @limitsql;
END
ça marche

Si vous avez des idées...
Merci d'avance,

Options: ReplyQuote


Subject
Views
Written By
Posted
procédure et variable
3652
July 22, 2010 08:42AM
1908
July 22, 2010 11:04AM
1552
July 23, 2010 07:58AM


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.