title: Execute SQL query on Oracle working in Unix prompt but not in shell script
body: <p>I am trying to connect to an Oracle db using a ksh script. When I run this directly from the prompt, it works. But when I put it inside a script (abc.sh) it fails. Below is what I've put in the script (edited to make it shorter):</p>
  
  <p>Here abc is the username, while abc$123 is the password of the user which has access on database DBNAME.</p>
  
  <pre><code> #!/usr/bin/ksh
  
   sqlplus -s /nolog &lt;&lt; EOF &gt; output
   connect abc/abc$123@DBNAME;
  
   set echo off
   set heading off
  
   select table_name from dba_tables;
   exit;
   EOF
  </code></pre>
  
  <p>This works if typed directly, but run as ./abc.sh, gives error -</p>
  
  <pre><code> ERROR ORA-01017: invalid username/password; logon denied
  </code></pre>
  
  <p>I'm sure I'm missing something simple, but can't figure this out. Thanks for your help.</p>