簡體   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