title: passing SET commands with SQL string in Python
body: <p>I can pass a sql command fine from Python, but cannot seem to combine it with a SET - I don't want headers, so SET HEADING OFF is what I'm attempting.</p>
  
  <p>Here's 4 attempts that show where I'm going:</p>
  
  <p>1 - Get date, but also error message:</p>
  
  <blockquote>
  <pre><code>session = Popen(['sqlplus','-S','user/pass@ORCL'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
  sqlCommand = "SET HEADING OFF \n / \n select sysdate from dual;"
  session.communicate(sqlCommand)
  ('SP2-0103: Nothing in SQL buffer to run.\r\n\r\n09-JUL-13\r\n\r\n', '')
  </code></pre>
  </blockquote>
  
  <p>2 - command without SET:</p>
  
  <blockquote>
    <p>session = Popen(['sqlplus','-S','user/pass@ORCL'], stdin=PIPE,
    stdout=PIPE, stderr=PIPE) sqlCommand = "select sysdate from dual;"
    session.communicate(sqlCommand)
    ('\r\nSYSDATE\r\n---------\r\n09-JUL-13\r\n\r\n', '')</p>
  </blockquote>
  
  <p>3 - tried a one-liner:</p>
  
  <blockquote>
  <pre><code>session = Popen(['sqlplus','-S','user/pass@ORCL'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
  sqlCommand = "set heading off \select sysdate from dual;"
  session.communicate(sqlCommand)
  ('SP2-0158: unknown SET option "\\select"\r\n', '')
  </code></pre>
  </blockquote>
  
  <p>4 - tried to separate into two calls:</p>
  
  <blockquote>
  <pre><code>session = Popen(['sqlplus','-S','user/pass@ORCL'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
  sqlCommand = "select sysdate from dual;"
  session.stdin.write('SET HEADING OFF')
  session.communicate(sqlCommand)
  ('SP2-0265: heading must be set ON or OFF\r\n', '')
  </code></pre>
  </blockquote>
  
  <p>Finally, if this is <em>not</em> the simplest way to get a value (and that's my goal - just one value back - this is not the final query), please let me know.  Any advice is welcome!</p>