首页 > Linux操作系统 > Linux操作系统 > sql_plus操作命令11
(10)serveroutput
该环境变量用于控制服务器输出,其默认值为off,表示禁止服务器输出。在默认情况下,当调用dbms_output包时,
不会在sql*plus屏幕上显示输出结果。在调用dbms_output包时,为了在屏幕上输出结果,必须要将serveroutput设置
为on。eg:
sql>set serveroutput on
sql>exec dbms_output.put_line('hello')
(11)termout
该环境变量用于控制sql脚本的输出,其默认值为ON。当使用默认值时,如果sql脚本有输出结果,则会在屏幕上输出
显示结果,如果设置为OFF,则不会在屏幕上输出sql脚本。eg:
SQL> set termout off
SQL> @c:\a
(12)time
该环境变量用于设置在sql提示符前是否显示系统时间,默认值为off,表示禁止显示系统时间。如果设置为on,
则在sql提示符前会显示系统时间.eg:
SQL> set time on
12:09:59 SQL>
(13)timing
该环境变量用于设置是否要显示sql语句执行时间,默认值为off,表示不会显示sql语句执行时间。如果设置为
ON,则会显示sql语句执行时间。eg:
sql>set timing on
SQL> select count(*) from emp;
COUNT(*)
----------
14
已选择 1 行。
已用时间: 00: 00: 00.03
(14)trimspool
set trimout on; //去除标准输出每行的拖尾空格,缺省为off
set trimspool on; //去除重定向(spool)输出每行的拖尾空格,缺省为off
如果trimspool设置为on,将移除spool文件中的尾部空格 ,trimout同trimspool功能相似,只不过对象是控制台。
If trimspool is set to on, it will remove trailing blanks in spooled files.
See also trimout which does the same thing to the output to the console (terminal).
eg:
set trimspool off
spool c:\temp\trimspool.txt
declare
v_name varchar2(30);
begin
SELECT table_name into v_name
FROM all_tables
WHERE rownum =1;
dbms_output.put_line(v_name);
end;
/
set trimspool on
declare
v_name varchar2(30);
begin
SELECT table_name into v_name
FROM all_tables
WHERE rownum =1;
dbms_output.put_line(v_name);
end;
/
spool off
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12137615/viewspace-616064/ ,如需转载,请注明出处,否则将追究法律责任。