Oracle SqlPlus - saving output in a file but don't show on screen

大兔子大兔子 提交于 2019-11-27 03:43:58

问题


Using SqlPlus for Oracle, how do I save the output of a query in a file but not show it on the terminal/prompt.


回答1:


Right from the SQL*Plus manual
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch8.htm#sthref1597

SET TERMOUT

SET TERMOUT OFF suppresses the display so that you can spool output from a script without seeing it on the screen.

If both spooling to file and writing to terminal are not required, use SET TERMOUT OFF in >SQL scripts to disable terminal output.

SET TERMOUT is not supported in iSQL*Plus




回答2:


Try this:

SET TERMOUT OFF; 
spool M:\Documents\test;
select * from employees;
/
spool off;



回答3:


Try This:

sqlplus -s ${ORA_CONN_STR} <<EOF >/dev/null



回答4:


set termout off doesn't work from the command line, so create a file e.g. termout_off.sql containing the line:

set termout off

and call this from the SQL prompt:

SQL> @termout_off


来源:https://stackoverflow.com/questions/6813210/oracle-sqlplus-saving-output-in-a-file-but-dont-show-on-screen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!