title: MySQL foreach alternative for procedure
body: <p>My problem is fairly simple. I have table <code>sets</code> that store product sets (more products looking like one on the outside - computer, mouse and keyboard for ex.) it's connected M:N using <code>sets_products</code> table to <code>products</code> table. Each product can have parameters (connected again M:N). </p>
  
  <p>I have a procedure, that generates all parameters as string (for search cache - like 'hdd:120GB, LCD:1440:900, ..'), but now I need to loop through the set's products and call the procedure for each of them. I CAN'T DO IT IN PHP, because this is used in trigger. </p>
  
  <p>I'd like to use something like this (pseudo SQL)</p>
  
  <pre><code>FOREACH(SELECT products_id FROM sets_products WHERE set_id = 1)
      generate_parameter_list(product_id,@result)
      @param = CONCAT(@param,",",@result);
  END FOREACH;
  </code></pre>
  
  <p>Can this be done in MySQL or not?</p>