Oracle 假脱机设置

发布于 2024-10-20 19:23:02 字数 475 浏览 1 评论 0原文

当我将多个选择查询输出假脱机到 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;

When i spool the multiple select query output to a txt file. I see empty new lines after each select query how can i get rid of it.

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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

找回味觉 2024-10-27 19:23:02

尝试 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;

Try TRIMSPOOL

SET FEEDBACK OFF
SET HEADING OFF
SET TRIMSPOOL ON

I changed your script to

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;

The output was

$ 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;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文