MySQL Forums
Forum List  »  French

Re: procédure et variable
Posted by: Jean Molliné
Date: July 22, 2010 11:04AM

Essaye en construisant une requête préparée :
DROP PROCEDURE IF EXISTS test2;
DELIMITER ||
CREATE PROCEDURE `test2`(IN nb INT )
  BEGIN
    SET @maximum = nb;
    SET @requete = "SELECT * FROM message LIMIT ?";
    PREPARE stmt FROM @requete;
    EXECUTE stmt USING @maximum;
  END ||
DELIMITER ;
Et teste ensuite simplement avec quelque chose du genre :
CALL test2(10);

______________________________________________________________
Une question bien formulée, c'est un problème bien compris : ça représente déjà les 3/4 de la réponse ;)

Options: ReplyQuote


Subject
Views
Written By
Posted
3655
July 22, 2010 08:42AM
Re: procédure et variable
1911
July 22, 2010 11:04AM
1553
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.