Hello ALL ,
i am requesting help on for this script i am preparing to get the result of a query in a excel sheet :
current Error:
Script : NO Excel file created.
requesting to know where i am going wrong.
#!/bin/ksh
#############################################################################
#NAME : OGS_TESTAK.ksh
#############################################################################
#############################################################################
# function : sql_getquery
#############################################################################
function sql_getquery
{
typeset SqlOut
SqlOut=`sqlplus -s ${CON_STR_ENB} << EOF
set feedback off
set pagesize 2000
set newpage none
set output off
spool $Impact_file
select a,b,c from D where e='122323';
${SQL_MODE};
spool off
exit
EOF`
cat $IMPACT_FILE >> $LOG_FILE (path will be given by me)
return $SUCCESS
}
#############################################################################
# function : exit_process
#############################################################################
function exit_process
{
typeset ExitCode=$1
case $ExitCode in
$SUCCESS)
(cat $LOG_FILE ; uencode $IMPACT_FILE $IMPACT_FILE) | mailx -s "[IMPACT] $CLIENT $TICKET IMPACT" $EMAILRECIP
;;
$FAILURE)
printf "script failed"
mail -s "test -ak! failed" $EMAILRECIP
;;
esac
exit $ExitCode
}
#############################################################################
# function : main
# purpose : Setup globals, functions
#############################################################################
# main()
typeset -r CON_STR_ENB=c1/c2@c3
typeset -r SPOOL_FILE=${SCRIPT_NAME}_${TS}.lst
typeset -r SQL_MODE=commit
typeset -r LOG_FILE=${SCRIPT_NAME}_${TS}.log
typeset -r IMPACT_FILE=Customer_Impact.xls
typeset -r EMAILRECIP=a@abc.com
#############################################################################
# script complete, send email and exit
#############################################################################
exit_process $SUCCESS