Hi,
I am getting the error "No matching <<", when i run the below. Is it that we can't execute SQL in a Unix loop. I am executing a SQL in a loop. Is it the EOF is written wrongly.
. /opt/app/wlsconfigv61/domains/profiles/oracleV901.profile
export DBUSER=ecdb01
set -A DBINSTANCE ECDBP01P ECDBP02P ECDBP03P ECDBP04P ECDBP05P ECDBP09P ECDBP10P ECDBP11P ECDBP12P ECDBP13P ECDBP14P ECDBP15P
SQLPLUS=${ORACLE_HOME}/bin/sqlplus
SQL_func()
{
filename=${3}
${SQLPLUS} -s $2/$3@$4 <<EOF
spool /export/home/mpdwwcz/sqlOutput/${filename}
set trimspool on
set heading off
set feedback off
set linesize 2000
set arraysize 4000
set pagesize 0
@/export/home/mpdwwcz/IICP_SH/sqlQuery.sql
spool off
exit
!EOF
exit $?
}
if [ ! -x ${SQLPLUS} ]
then
echo "ERROR: Cannot find ${SQLPLUS}. Set the environment variables ORACLE_HOME etc..."
exit -1
fi
i=0
while [ i -lt 11 ]
do
PASSWD=`/opt/app/cbs/CBSDBSecurity/Scripts/ksh/CBSGetPw ${DBINSTANCE[i]} $DBUSER`
echo "DBINSTANCE Is : ${DBINSTANCE[i]}"
echo "DBUSER Is : $DBUSER"
rm /export/home/mpdwwcz/sqlOutput/${filename}
SQL_func $SQLPLUS $DBUSER $PASSWD $DBINSTANCE[i]
i=`expr i + 1`
done
exit $?