title: MySQL Select into variable
body: <p>I want to further use in the procedure the values I get from a select into execution but can't figure out how to do it.</p>
  
  <p>As a test I wrote the following but cannot use the v_1, v_2 or v_3 variables for further logic as they don't take the values 1,2 &amp; 3 as i expected...</p>
  
  <pre><code>DROP PROCEDURE IF EXISTS MPT_testing; DELIMITER //  CREATE PROCEDURE MPT_testing() READS SQL DATA BEGIN
  
    DECLARE v_1 INT;   DECLARE v_2 INT;   DECLARE v_3 INT;
       SET @sql=CONCAT('SELECT 1,2 into v_1, v_2');   PREPARE s1 FROM @sql;   EXECUTE s1;   DEALLOCATE PREPARE s1;
  
    SET v_3 = v_1 + v_2;
  
    SELECT v_3;
  
  END //
  
  DELIMITER ;
  </code></pre>
  
  <p>Can somebody help here please?</p>
  
  <p>thanks,
  Leo</p>