title: How to use sqlplus and sqlldr in a script file?
body: <p>I am using sqlplus to get data from a remote database table and then using sqlldr to insert that data into some other table. I have written a shell script to do this. The sqlplus option is working but the sqlldr command is not working, although I have been able to insert using it from command prompt but it seems not be working in file.</p>
  
  <p>Here's my script.</p>
  
  <pre><code> #!/bin/bash
   #script to get 5 minutes of data from FCT table and insert into LOCAL table
   sqlplus -s user/passs@FCT_DB &lt;&lt;EOF
   SET TERMOUT OFF
   SET LINESIZE 300
   SET HEAD OFF
   SPOOL export.csv
   SELECT X FROM Y
   SPOOL OFF
   EXIT
   EOF
   ! SQLLDR usr/pass@LOCAL_DB CONTROL=loader.ctl ERRORS=5000
  </code></pre>
  
  <p>The export.csv is created correctly. loader.ctl is also correct. </p>
  
  <p>Also, whenever the script runs it shows data fetched on shell. I have searched that SET TERMOUT OFF helps not to display it, but it also doesn't seem to work.</p>