title: Is there any way to query a MySQL stored procedure for its returned column names and their data types?
body: <p>Is there any way to automatically find out the returned column names of a stored procedure and their data types?</p>
  
  <p>Assuming my stored procedure is as follows:</p>
  
  <pre><code>CREATE PROCEDURE `user_countries`()
  BEGIN
  select m.ID, m.Name, c.Country
  from Member AS m, Country AS c
  where m.CountryId = c.ID;
  END$$
  </code></pre>
  
  <p>This returns me a table which looks like this:</p>
  
  <pre><code>ID    |  Name  |  Country
  -------------------------
  1       John      USA
  2       Mary      Australia
  </code></pre>
  
  <p>I need to be able to query my stored procedure so that I can see something like the following</p>
  
  <pre><code>ColName   |    Data Type    
  ------------------------
  ID        |    INT
  Name      |    Varchar(50)
  Country   |    Varchar(50)
  </code></pre>
  
  <p>I have not heard of anything that can be done for a stored procedure similar to the table equivalent of </p>
  
  <blockquote>
    <p>describe Member;</p>
  </blockquote>
  
  <p>Any suggestions?</p>
  
  <p>PS. This is just a trivial example, I have hundreds of tables and hundreds of stored procedures of varying complexity which I need to analyze.</p>
  
  <hr>
  
  <p><strong>ANSWER</strong>
  Thanks to @BishnuPaudel from the comments below.</p>
  
  <p>I am connecting to the db via c# .net so the approach was to query the data which was returned from the stored procedure rather than accessing it via mysql commands.</p>
  
  <p>Using the example from the msdn library</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.columns(v=vs.110).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.data.datatable.columns(v=vs.110).aspx</a></p>
  
  <p>I have added the column.DataType print statement to see the Datatypes of the column.</p>
  
  <pre><code>    private void PrintValues(DataTable table) {
          foreach (DataRow row in table.Rows)
          {
              foreach (DataColumn column in table.Columns)
              {
                  Console.WriteLine(column.DataType);
                  Console.WriteLine(row[column]);
              }
          }
      }
  </code></pre>
  
  <p>Thanks again.</p>