if I run the below mentioned code, i am getting error. I dunno why. plz help me out this code runs a sql query and sends the result by email
#!/bin/ksh
#
# Purpose: - Report Workflows that have Persistence turned ON
echo "Workflow Persistence Report Started: `date '+%Y%m%d_%H%M%S'`" >> master.log
umask 000
if [ -f ./Workflow_Persistence_env.rc ]
then
. ./Workflow_Persistence_env.rc
else
echo "FATAL: Error sourcing fusion_employee_list.rc !" >> master.log
exit -1
fi
# Obtain the secure username and password (if it exists)
#
if [ -f "$BATCH_USER_DIR/batch_user.ksh" ]
then
TMPPWD=`pwd`
cd $BATCH_USER_DIR
. ./batch_user.ksh
RTNCD=$?
cd $TMPPWD
if [ $RTNCD = 0 ]
then
export SIEBEL_USERNAME=$USERID
export SIEBEL_PASSWORD=$PASSWORD
else
echo "FATAL: batch_user.ksh returned an error ($RTNCD)" >> master.log
exit -1
fi
else
echo "ERROR: batch_user.ksh does not exist, unable to source in variables" >> master.log
exit -1
fi
export LT=`date +%Y%m%d_%H%M%S`
export RDATE=`date +%Y-%m-%d`
sqlplus -S $SIEBEL_DB_USERNAME/$SIEBEL_DB_PASSWORD@$SIEBEL_DB_ORACLESID >> master.log <<!
set head off
set pagesize 0
set linesize 1000
set trimspool off
spool $REPORT_FILE;
SELECT "||A.NAME||'|'||B.STATUS_CD||" FROM $SIEBEL_DB_TABLE_OWNER.S_WF_STEP A, $SIEBEL_DB_TABLE_OWNER.S_WF_STEP_INST B where
B.STATUS_CD = 'ACTIVE';
spool off
QUIT;
!
####################
# Send file in e-mail
####################
usr/bin/mailx -s "Workflow Persistence On" $MAIL_LIST <<-EOF1
Open this file in Excel with a , (comma) as a delimiter.
Please DO NOT respond to this email, instead contact the WB: E-CRM System Support group for any issues.
Thank you.
~< ! uuencode $CSV_PATH/$REPORT_FILE $REPORT_FILE
~.
EOF1