Execute Shell Script
Unix Shell Script (KSH example):
------------- Beginning of Script---------------------------------
#execScript.sh
#Execute Oracle query (SQL)/stored procedure (PL/SQL)
#Created Date: March 15, 2008
ORACLE_HOME=/oracle/theDBName/10.2.0; export ORACLE_HOME
ORACLE_SID=theDBName; export ORACLE_SID
sqlloc=$ORACLE_HOME/bin; export sqlloc

bindir=/server_folder/sales/bin; export bindir
logdir=/server_folder/sales/log; export logdir

ddate=`date +%Y%m%d`; export ddate

echo "Monthly Sales load on `date +%m/%d/%Y`:" > $logdir/$ddate_execScript.log
$sqlloc/sqlplus /nolog @$bindir/execScript >> $logdir/$ddate_execScript.log
if [ $? -ne 0 ]
  then
    echo "Error - Processing Invoice Files for $ddate" 
    echo "Error - Processing Invoice Files for $ddate" >> \
     $logdir/$ddate_execScript.log
    exit 1
fi

------------- End of Script---------------------------------------
Notes:
1. # - Signifies comment in Unix shell script (KSH) 
2. The "theDBName" has to be replaced by actual database name
3. execScript will be execScript.sql file in the bin directory


Database Directory

Output data using UTL_FILE

Oracle registered trademark of Oracle Corporation.

Last Revised On: May 07th, 2008

  55651