I have to create 1 UNIX Shell script. In that shell script i want to run multiple SQL script files from the same directory. I have used like this-
#!usr/bin/ksh
SQLPATH = /usr/sql/
(cd $SQLPATH;
'sqlplus usr/password@sid <<EOF
spool <db_file>.log
@<db_name>.sql
set echo off
set heading off
spool off
&&
spool <db_file2>.log
@<db_name2>.sql
set echo off
set heading off
spool off
&&
spool <db_file3>.log
@<db_name3>.sql
set echo off
set heading off
spool off
exit;
EOF')
exit 0
There are multiple SQL scripts like this and for each SQL script I have to create log files so I used spool
here. After every SQL script files execute
I used &&
. So Is it good to use &&
here and in 3rd line ;
when I define the PATH. Please provide me the better solution.