Oracle SqlPlus - 将输出保存在文件中但不显示在屏幕上

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6813210/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:26:15  来源:igfitidea点击:

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

oraclesqlplus

提问by simplfuzz

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

使用 SqlPlus for Oracle,如何将查询的输出保存在文件中,但不在终端/提示上显示。

回答by a_horse_with_no_name

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

来自 SQL*Plus 手册
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 scriptwithout 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

设置终端

SET TERMOUT OFF 禁止显示,以便您可以假脱机脚本的输出而不会在屏幕上看到它。

如果不需要假脱机到文件和写入终端,请在 >SQL 脚本中使用 SET TERMOUT OFF 来禁用终端输出。

iSQL*Plus 不支持 SET TERMOUT

回答by Mohammad

Try this:

尝试这个:

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

回答by Ashish Anand

Try This:

尝试这个:

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

回答by pelms

set termout offdoesn't work from the command line, so create a file e.g. termout_off.sqlcontaining the line:

set termout off不能从命令行工作,所以创建一个文件,例如termout_off.sql包含以下行:

set termout off

and call this from the SQL prompt:

并从 SQL 提示符调用它:

SQL> @termout_off