title: Stored Procedures variable assignments on Cursor
body: <p>I'm creating an exchange site and really need a transaction to be made. First, make a Select and find some data, and then some updates and inserts according with the results given.</p>
  
  <p>I won't post the full query as it might be very complicated to read so I created a new query to point out whats bothering.</p>
  
  <p>Table Log</p>
  
  <pre><code>    CREATE TABLE `log` (
        `num_rows` int(10) unsigned NOT NULL,
        `new_value` int(10) unsigned NOT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>Stored Procedure</p>
  
  <pre><code>    DROP PROCEDURE IF EXISTS `test`//
  
      CREATE PROCEDURE `test` (IN var1 BIGINT) 
      BEGIN
        DECLARE result INT;
        DECLARE num_rows INT;
  
        DECLARE cur1 CURSOR FOR
          SELECT @var1 := @var1 +1 AS result;
        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
  
        START TRANSACTION;
          OPEN cur1;
          SELECT FOUND_ROWS() into num_rows;
          INSERT INTO log (num_rows,new_value) VALUES (num_rows,var1);
  
          CLOSE cur1;
        COMMIT;
      END//
  </code></pre>
  
  <p>When I try</p>
  
  <pre><code>    CALL test(1);
  </code></pre>
  
  <p>Im passing 1 as var1 parameter. So in cur1, the value should be increased. And later insert a new row to the log with the new value. It looks like := asignment isn't working.</p>
  
  <p>I actually changed</p>
  
  <pre><code>    SELECT @var1 := @var1 +1 AS result;
  </code></pre>
  
  <p>for this</p>
  
  <pre><code>    SELECT var1 := var1 +1 AS result;
  </code></pre>
  
  <p>And get an error on ":= var1 +1"</p>