title: How to pass a list of IDs to MySQL stored procedure?
body: <p>I'm writing a stored procedure which should pass its arguments to <code>IN (..)</code> part of query in the procedure body, like this:</p>
  
  <pre><code>DELIMITER //
  
  CREATE PROCEDURE `get_users_per_app` (id_list TEXT)
  BEGIN
      SELECT app_id, GROUP_CONCAT(user_id) FROM app_users WHERE app_id IN (id_list) GROUP BY app_id;
  END//
  
  DELIMITER ;
  </code></pre>
  
  <p>This, obviously, doesn't work because when I pass a textual value, <code>id_list</code> is interpolated as an integer and only first ID is considered and used inside of <code>IN()</code> condition.</p>
  
  <p>I realize that this particular type of procedure could be instead replaced by the contained query, but I think that my question still stands - what if I needed to pass this kind of data?</p>
  
  <p><em>I also realize that this approach of query might not be considered the best practice, but in my use case it's actually better than returning a flat list of ID-ID pairs..</em></p>