title: How do I store and iterate over a result set in a MySQL Stored Proc?
body: <p>I'm relatively new to MySQL stored procs, so I was hoping someone could help me out here. I want to call my stored proc (maybe pass in one <code>IN</code> param) and have it do the following:</p>
  
  <ol>
  <li><code>SELECT</code> some data</li>
  <li>Iterate over the records</li>
  <li>Perform some operations on a few of the fields in each record including some <code>INSERT</code>s in other tables based on the data it finds.</li>
  </ol>
  
  <p>My problem is that I don't know how to store the <code>SELECT</code> data set and iterate the records. I know how to <code>declare</code> and <code>set</code> stuff like <code>int</code> and <code>text</code>, but not full data sets. How do I do this?</p>
  
  <p>Thanks</p>