SET FEEDBACK OFF AND SET TERM OFF AND SET ECHO OFF

set feedback off :主要是关闭通过sqlplus 检索出来的结果最下面一般会有一个" 8 row selected"的提示 这个是用于关闭它的

 

set echo on | off  :这个也是在掉用脚本后屏幕是否输出sql语句以及sqlplus语句的设置选项
With echo it is possible to control if echoing of SQL statements and SQL*Plus commands is enabled or not.
If echo is set to off, SQL statements that are run will not be displayed while setting echo to on will display them.

 

set echo on

set term off 

调用@a.sql 不会显示任何信息

 

set echo on

set term on

调用 @a.sql 会显示sql statement 以及 result set

 

set echo off

set term on

调用 @a.sql 不显示 sql statement 显示 result set

 

 

set term off: 官方解释To spool output (generated by commands in a script) without displaying the output on the screen, use SET TERMOUT OFF. SET TERMOUT OFF does not affect output from commands run interactively.

 

another:

When people speak of writing SQL*Plus output to a file, the term spool is often used as a verb. You are said to be spooling your output to a file. The SPOOL command is used for this purpose, and you will need to use it twice, once to turn spooling on and again to turn it off.

 

可以这么理解:spool命令是把screen上所有的信息都显示输出到指定文件,如果这个信息是由于调用脚本命令(@a.sql)而生成的信息,那么把  set term off 设置完成后,是不会显示到屏幕上的,

但是如果这个信息产生是来自交互式的命令行,那么仍然产生(select * from cat;)。

通过做实验知道实际这个set term off 设定后所有脚本调用的结果都不会输出到屏幕,与spool也没关系,只不过一般常用如下这种形式而已

 set term off

 spool 2010.log

 @a.sql

 spool off 

 

 

顺便说一下 linux一般常用 sqlplus user/pswd @script.sql 这种命令 ,好处是这样每次就不会因为以前设定的sqlplus格式而影响当前脚本设定的格式,还有如果是为了安全考虑不把用户名和密码写在脚本里面的话,那么可以这样建立一个Ops$reporters的oracle用户,当然这个reporters在unix或者linux系统上也有该用户,然后让他执行 sqlplus / @scripts 然后手动的输入进入数据的用户名以及密码就ok

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值