title: CRON and SQLPLUS
body: <p>I want to run a script, which contains some sqlplus commands, in cron.</p>
  
  <p>The problem is, that the sqlplus command won't be executed for some reason, when executed in cron. If I execute it by myself, the script runs fine.</p>
  
  <p>I've checked some forums, even the topics here on stackoverflow.com and found some tips regarding the correct setting of environment variables. But even after double checking this, the script doesn't work.</p>
  
  <p>Here is my script:</p>
  
  <pre><code>echo $ORACLE_HOME|grep "oracle" &gt; /dev/null
  if [ $? = 1 ] ; then
     echo "Setting environment variable"
     # Setting oracle environmet
     . /usr/oracle/product/10.2.0/.profile
     NLS_LANG='AMERICAN_GERMANY.WE8ISO8859P1'
  fi
  
  /usr/oracle/product/10.2.0/bin/sqlplus username/password @basics.sql &gt; export.file
  </code></pre>
  
  <p>basics.sql contains:</p>
  
  <pre><code>set pagesize 0
  set feedback off
  set heading off
  set linesize 400
  set NULL nll
  
  SELECT SOME_FIELDS FROM TABLE ORDER BY FIELD;
  EXIT;
  </code></pre>
  
  <p>Any ideas?</p>