title: How to write MySQL procedure output directly to file?
body: <p><a href="https://stackoverflow.com/questions/356578/how-to-output-mysql-query-results-in-csv-format">It is quite simple to write an MySQL query result directly to a CSV file</a>:</p>
  
  <pre><code>SELECT * FROM MyTable INTO OUTFILE '/my/file.csv'
  </code></pre>
  
  <p>How can I write the table output of a procedure directly to a file, i.e. something alike this?</p>
  
  <pre><code>CALL MyProc('MyPar1') INTO OUTFILE '/my/file.csv'
  </code></pre>
  
  <p>The procedure should not be changed.</p>