I am trying to get the data from oracle table to a variable I have tried the below code
#/usr/bin/sh
echo " I am in correct loop"
SPOOL_FILE=/app/scripts/alt.lst
sqlplus /nolog <<END_SQL
connect bindu/bindu@gis
whenever sqlerror exit failure rollback;
set serveroutput on
set termout on
set trimspool on
SPOOL $SPOOL_FILE
select 'SQLCODE' ||'count(*) from altuomlog
/
spool off
EXIT
END_SQL
echo " I am in correct loop"
SQLCODE='cat ${SPOOL_FILE} | grep SQLCODE | awk '{print $2}''
echo $SQLCODE
unset EXIT_STATUS
unset SQL_CODE
echo "END.. I am in correct loop"
when I ran this code the it got exit from the oracle after completion of the select statement the rest of the shell script is not executed.if I removed the exit statement the in that case the shell is throwing error.
Please advice..
Thanks in advance..