Please kindly help me. I try to spool sql statement to log file by us
set echo option but it can not.
I wrote sql statement in shell script.
Thank you very much.
Printable View
Please kindly help me. I try to spool sql statement to log file by us
set echo option but it can not.
I wrote sql statement in shell script.
Thank you very much.
do you mean spool the output of a script?
In which case use SPOOL filename
Or to save a sql script SAVE scriptname
Regards
I mean that I want to spool sql statement and output also.
try this
This gives you the script and the output in a single text fileCode:SQL>SPOOL script.txt
SQL>LIST
1 SELECT
2 dbid,
3 name,
4 created
5 FROM
6* v$database
SQL> /
DBID NAME CREATED
---------- --------- ---------
2799508272 ZOIDBERG 10-JAN-02
SQL> SPOOL OFF
Regards
spool /home/xxx/update_xxx.log
sqlplus -s set serveroutput on
set echo on
set time on
set timing on
select *
from emp ;
spool off;
but it can not spool
select *
from emp;
to /home/xxx/update_xxx.log
Please kindly investigate my script
Thank you very much. :)
I assume this is a unix platform, I think the following is more what your looking for, create a unix file with execute permissions:
RegardsCode:sqlplus -s scott/tiger <<-! > /home/xxx/update_xxx.log
set serveroutput on
set echo on
set time on
set timing on
select *
from emp ;
list;
!
exit
change your script to this:
sqlplus -s set serveroutput on
set echo on
set time on
set timing on
spool /home/xxx/update_xxx.log
select *
from emp ;
spool off;
Note: this will overwrite the "/home/xxx/update_xxx.log" each time you run the sql script.
Thank you very much Jovery and Bgill .
Right now I can do it as you suggest. :)