I have created abc.sh file which will set the environment variables (UNIX env variables as well as ORACLE required variables like ORACLE_SID,ORACLE_HOME etc) and then calls a function file which checks for starts some logs and then it will try to execute the .sql file. The .sh, function file are as follows
--ABC.SH
#!bin/ksh
. /rcs/ct/src/bin/initialize_ct_func # This is calling the initializing func file
sql_run_ct_func_test /rcs/ct/scripts/test.sql #Calling the function file
--FUNCTION FILE
function sql_run_ct_func_test
{ v_function_name=sql_run_ct_func_test;
start_ct_func "$@"
if [ ! -a $1 ]
then
echo "!!! FAILED !!!" $1 "failed, exit status: 2" >> $v_shell_log
exit 2
fi
$SQLCMD << EOHD
set term off
set pages 0
set feedback off
set heading off
--set echo off
set pause off
set serverout on
whenever sqlerror exit rollback
spool $v_function_log
@$1
exit sql.sqlcode
EOHD
Now the problem is that the function file is being called and then exiting immediately without doing any thing. I tried checking whether Oracle env variables are set properly by adding "sqlplus uid/pwd" to the Environment variables setting file, which is working fine. But some how from function I am unable to execute the .sql file.