title: Create text file in oracle using sql
body: <p>I need to grab data from some oracle database tables and format it into a fixed width text file.
  I want to know if its possible to create a text file using sql.
  I looked at some stuff and found the bc and xp_cmdshell but they are a bit confusing.</p>
  
  <p>I am pretty new to sql and oracle databases.</p>
  
  <p>Is this possible and how can I begin?</p>
  
  <p>I don't need to open a file or check for existing file, overwriting is fine, what ever makes it easiest.
  I don't need anything big or complex, a simple script to grab values and create a text file.</p>
  
  <p>Just an update:
  I don't think bcp works in the toad for oracle editor.
  I found this tutorial here: <a href="http://www.sqlteam.com/article/exporting-data-programatically-with-bcp-and-xp_cmdshell" rel="nofollow">http://www.sqlteam.com/article/exporting-data-programatically-with-bcp-and-xp_cmdshell</a>
  but the first bcp command does not compile, it says invalid sql query</p>