Hi
I want ot save SQL query result in one txt file. for that i have written one code line
sqlplus -s $dbstring @/usr/local/bin/sched/nightly_Cronjob/exec_123.sql >> /usr/local
/bin/sched/nightly_Cronjob/result.txt
but it is not working .
database : Oracle
so please advice me how can i solve this prob.:(
Thanks in advance
You can easily do this b spooling your result to text file from sql codes.
If this could mean what you want, then try it:
spool result.txt
<select ...... from .... >
spool off;
I thnk this might help u out
sqlplus -s $dbstring @/usr/local/bin/sched/nightly_Cronjob/exec_123.sql 2>&1 >/path/to/save the file
if u want to append to file u can use
O/P will be saved in file_name.txt
sqlplus -s user/password@dbname <<EOF
set feedback off trimspool on
spool file_name.txt;
select * from table_name;
spool off;
exit;
EOF
Without spool.
Sql:
set linesize 2000 trims on pagesize 0 feedback off
select * from global_name;
exit
Call:
sqlplus -s $dbstring @your.sql 2>&1 >> result.txt