Is it possible to set the server output only into the spool file and not in the shell ?
set serveroutput on
spool log.txt
exec MY_PROCEDURE();
spool off
Inside MY_PROCEDURE
I have this :
DBMS_OUTPUT.put_line('Hello World');
I would like to put Hello World
only in log.txt
, not in the screen shell.
Simplest way is to pipe the unix output to /dev/null
$ sqlplus -S user/password @test.sql > /dev/null
$ cat test.sql
set serveroutput on
set feedback off
spool log.txt
exec dbms_output.put_line('This is great!! and working');
spool off;
exit;
$ cat log.txt
This is great!! and working
$