Oracle trimspool 仅尾随空白(不是前导空白)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4760926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle trimspool only trailing blanks (not leading blanks)
提问by FrustratedWithFormsDesigner
I am wondering if there's any tricks to get trimspool
to only trim trailing whitespace on the right.
我想知道是否有任何技巧可以trimspool
只修剪右侧的尾随空格。
I have code that uses dbms_output.put_line to print to the console, and the output often has indentation to make it easier to scan with the eyes. I set the line width rather large to make some of the output easier to read, so I also set trimspool to get rid of extra white space. The only problem is that now the leading which space is removed as well as the trailing whitespace. Is there a way to fix this? I could add a leading (before the leading whitespace) ".
" character to some of the output statements, but I'm not allowed to modify the code in most of the packages.
我有使用 dbms_output.put_line 打印到控制台的代码,并且输出通常有缩进,以便更容易用眼睛扫描。我将线宽设置得相当大以使某些输出更易于阅读,因此我还设置了trimspool 以去除多余的空白。唯一的问题是现在删除了前导空格以及尾随空格。有没有办法来解决这个问题?我可以.
在一些输出语句中添加一个前导(前导空格之前)“ ” 字符,但我不允许修改大多数包中的代码。
Here's what it outputs with no trimmimg:
这是它在没有修剪的情况下输出的内容:
level 1 (EOL) level 2 (EOL) Some data (EOL)
Here's what it currently outputs with trimspool
on:
这是它当前输出的trimspool
内容:
level 1(EOL) level 2(EOL) Some data(EOL)
HEre's what I want:
这就是我想要的:
level 1(EOL) level 2(EOL) Some data(EOL)
回答by René Nyffenegger
I guess you're after
我猜你在追求
set serveroutput on size 100000 format wrapped
if I do understand your question.
如果我理解你的问题。
If I do this:
如果我这样做:
set serveroutput on size 1000000
begin
dbms_output.put_line('no indent');
dbms_output.put_line(' indent');
end;
/
SQL*Plus outputs:
SQL*Plus 输出:
no indent
indent
If, however, I do
但是,如果我这样做
set serveroutput on size 1000000 format truncated
begin
dbms_output.put_line('no indent');
dbms_output.put_line(' indent');
end;
/
SQL*Plus outputs:
SQL*Plus 输出:
no indent
indent
You have to set trimspool on
in order to eliminate the spaces up to eol
.
set trimspool on
为了消除空格,您必须这样做eol
。