title: how to run inline query in mysql
body: <p>I am working with TSP(Traveling salesmen problem) Solution in mysql.</p>
  
  <p>for that we are going to develop procedure where i want to execute following query</p>
  
  <pre><code>-- variable coming from java
  
      CREATE PROCEDURE solve_tsp(
      inout ids varchar(21845);
      )
      begin
      declare ret_ids varchar(21845);
      -- some code
  
      while length(ids) &gt; 0 do
  
      -- some assignment 
          SELECT to_id,distance into @l_tmp_id,@l_distance FROM mst_distance_matrix WHERE  from_id =',@l_tmp_id,' AND 
  to_id IN (ids) -- ids is variable contains comma delimited string.
  order by distance desc limit 1
  
      -- concat value of to_id in ret_ids variable and then remove from ids variable   
  
      end while;
  
      select ret_ids;
      end;
  </code></pre>