title: How to submit the query by stored procedure in MySQL?
body: <p>Hello I am trying to automate my history tracking procedure in MySQL.
  The procedure should update a table and create another using uid as a name.</p>
  
  <pre><code>CREATE PROCEDURE `InsertQueryStore`( u VARCHAR(128), ID INT, q VARCHAR(1024) )
  BEGIN   
    INSERT INTO querystore(`qID`, `qstring`, `user`) VALUES(ID, q, u); # this works 
  # DROP TABLE IF EXIST ID ; //Can I do something like this?
  # CREATE TABLE ID q; // The q is a query string which should return results into to table ID
  END;
  </code></pre>
  
  <p>then I would like to call as:</p>
  
  <pre><code>Call InsertQueryStore("myname", 100, "select * from mydb.table limit 10")
  </code></pre>
  
  <p>What is the proper way to use the varchar variable in the procedure?</p>
  
  <p>Thank you beforehand.
  Arman.</p>