title: 'select into' statement not working in mysql store procedure with cursor
body: <p>Here is the issue: temprequest is the table where i fetch rows from.
  I look up the deliverableId column of deliverable table based on the temprequest table while fetching. therefore i use a select into statement. but the variable where I put the looked up value is only working for the first row fetched.</p>
  
  <p>The 'Begin end' block:</p>
  
  <pre><code>DECLARE no_more_rows BOOLEAN;
  DECLARE nr_rows INT DEFAULT 0;  
  DECLARE loop_cntr INT DEFAULT 0;
  
  declare delId int;
  
  declare vtname varchar(200);
  declare tversion varchar(200);
  declare custId int;
  declare prod varchar(200);
  
  DECLARE c_temp CURSOR FOR select tname, version,BuID,BuprodName from temprequest;
  SET no_more_rows = False;
  
  OPEN c_temp;
  select FOUND_ROWS() into nr_rows;
  
  the_loop:LOOP
      FETCH c_temp into vtname,tversion,custId, prod;
      IF no_more_rows THEN            
          LEAVE the_loop;
      END IF;
      -- statements for each request record
      Set delId= (SELECT deliverableId  
                  FROM deliverable 
                  WHERE deliverable.Product_prodName =vtname AND deliverable.version = tversion);
      INSERT INTO request VALUES (delId, custId, prod);               
      SET loop_cntr = loop_cntr + 1;
  
  END LOOP the_loop;
  CLOSE c_temp;
  </code></pre>