title: mysql stored procedure select and update selected
body: <p>i am trying to write a stored procedure for mysql, and basicly, it will select one id, and update selected id's operationdate. </p>
  
  <pre><code>DELIMITER //
   CREATE PROCEDURE getID(
    IN proc_intervaldate datetime
   )
  
   BEGIN
      DECLARE RUserID BIGINT;
      SELECT 
          UserID 
      INTO RUserID 
      FROM Tasks
      WHERE  OperationDate &lt; proc_intervaldate
      LIMIT 1 ;
  
      UPDATE Tasks SET OperationDate = now() WHERE UserID = RUserID;
  
      SELECT RUserID ;
  
  
   END //
  DELIMITER ;
  </code></pre>
  
  <p>but when i use this, procedure, it will return UserID but not update, if i comment </p>
  
  <pre><code>SELECT RUserID
  </code></pre>
  
  <p>then, it updates, but no data returns.</p>