title: How to pass input from shell script to sqlplus?
body: <p>I have been asked to change a part of the existing SQLPLUS script to a shell script to allow for more options. </p>
  
  <p>Here is what the original SQLPLUS script was prompting for:</p>
  
  <pre><code>SPOOL results.txt;
  WHENEVER OSERROR EXIT 9;
  WHENEVER SQLERROR EXIT SQL.SQLCODE;
  PROMPT
  PROMPT This script upgrades the database to the most recent version of eV8.0.
  SET VERIFY OFF;
  SET SERVEROUTPUT ON;
  
  ACCEPT continue_flag CHAR PROMPT 'Are You ready to continue Y/N? '
  PROMPT
  </code></pre>
  
  <p>My shell script now looks like :</p>
  
  <pre><code> #!/bin/sh
  
  echo "Please enter database username"
  read eval_user
  echo "Please enter database password"
  read eval_pass
  echo "Please enter the database name"
  read db_name
  
  $ORACLE_HOME/bin/sqlplus -s /nolog &lt;&lt;-EOF &gt;&gt; ${LOGFILE}
  connect $eval_user/$eval_pass@$db_name
  
  set serveroutput on format wrapped
  set pages 0 lines 300 trimout on trimspool on
  set echo off feedback off sqlprompt ''
  
  SPOOL results.txt;
  WHENEVER OSERROR EXIT 9;
  WHENEVER SQLERROR EXIT SQL.SQLCODE;
  PROMPT
  SET VERIFY OFF;
  SET SERVEROUTPUT ON;
  
  ACCEPT continue_flag CHAR PROMPT 'Are You ready to continue Y/N? '
  PROMPT
  </code></pre>
  
  <p>I get this error when the SQLPLUS prompt line is reached:</p>
  
  <pre><code>Are You ready to continue Y/N? You have entered an invalid response. Exiting.
  BEGIN
  *
  ERROR at line 1:
  ORA-06501: PL/SQL: program error
  ORA-06512: at line 13
  </code></pre>
  
  <p>I am new to sqlplus, so I know it is something to do with the settings I set in the beginning, if I set echo off feedback off sqlprompt ' '. But, on removing the line, the script just hangs. </p>
  
  <p>Should I take the prompts completely out of SQLPLUS and use it only in the shell part?</p>