I am new to sqlplus as well as shell.
have an req where I need to send the .sql file and the place where the script has to create a .csv file with the out of the query as a parameter when the shell script is called.
Currently My script looks like this.
#!/bin/ksh
set timing on
Filename=$1
Sqlfile=$2
sqlplus -S username/Pwd@dbname<set timing off heading on feedback off pagesize 0 linesize 250
WHENEVER SQLERROR EXIT FAILURE
WHENEVER OSERROR EXIT FAILURE
spool ${Filename}
@${Sqlfile}
spool off;
Exit;
EOF
I am calling the script like this
./hema.sh path/sqlfile.csv path/sqlfile.sql
I am able to find that the paramaters are not taken by the sqlplus commands
and hence not taking the exact sql which needs to be executed and neither creating a .csv file with proper name.
Could anyone help me in getting this sorted out as its very urgent.
Thanks
Hema.