繁体   English   中英

Oracle假脱机设置

[英]Oracle Spool setting

当我假脱机多选查询输出到txt文件。 在每次选择查询后,我都看到空的新行,我该如何摆脱它。

define spool_file = 'D:\test1'

--set serveroutput on;

SET ECHO OFF

SET NEWPAGE 0

SET SPACE 0

SET PAGESIZE 0

SET FEEDBACK OFF

SET HEADING OFF


-- set echo on  ;

spool D:\test1;

select 'H,correction.csv,'  ||  to_char(sysdate,'DD/MM/YYYY')  from dual;

select 'D,' ||record_id      from cl_record where status=15;

select 'T,correction.csv,' from cl_record where status=15;

spool off;

试试TRIMSPOOL

SET FEEDBACK OFF
SET HEADING OFF
SET TRIMSPOOL ON

我将您的脚本更改为

define spool_file = '/home/alain/test.log'
--set serveroutput on;
SET ECHO OFF
SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET FEEDBACK OFF
SET HEADING OFF
SET trimspool on
--set echo on ;
spool /home/alain/test.log;
select sysdate from dual;
select 'hello ' || 'world' from dual;
spool off;

输出是

$ cat test.log
SQL> select sysdate from dual;
03-08-2011 07:48:26
SQL> select 'hello ' || 'world' from dual;
hello world
SQL> spool off;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM