title: Assign output of an oracle sql query to a variable in shell script
body: <p>im trying to save the output of a query in a variable. I followed some answers here in stackoverflow but no luck. Currently i'm using this </p>
  
  <pre><code>billerrors=$(sqlplus -s $username/$password@$SID &lt;&lt; EOF
  set pagesize 0 feedback off verify off heading off echo off;
  SELECT ERROR from temp_table
  exit;
  EOF
  )
  
  echo $billerrors
  </code></pre>
  
  <p>The output i always get is </p>
  
  <blockquote>
    <p>SQL<em>Plus: Release 11.2.0.1.0 Production Copyright (c) 1982, 2009,
    Oracle. All rights reserved. Use SQL</em>Plus to execute SQL, PL/SQL and
    SQL*Plus statements.</p>
  </blockquote>
  
  <p>The output of the above query SELECT ERROR from temp_table will be in the below format</p>
  
  <pre><code>Bill payment errors in the last 30 minutes: XX : 70. YY : 20.
  </code></pre>
  
  <p>Incase of no bill errors, the output will be</p>
  
  <pre><code>Bill payment errors in the last 30 minutes: 0.
  </code></pre>
  
  <p>I would really appreciate if someone could help</p>