Oracle Trimpool仅尾随空格(不包括前导空格) [英] Oracle trimspool only trailing blanks (not leading blanks)
问题描述
我想知道是否有任何技巧可以使trimspool
仅在右侧修剪尾随空白.
I am wondering if there's any tricks to get trimspool
to only trim trailing whitespace on the right.
我有使用dbms_output.put_line打印到控制台的代码,并且输出通常具有缩进形式,以使其更容易用眼睛进行扫描.我将线宽设置得相当大,以使某些输出更易于阅读,因此,我还设置了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.
这里是没有trimmimg输出的内容:
Here's what it outputs with no trimmimg:
level 1 (EOL)
level 2 (EOL)
Some data (EOL)
以下是当前在trimspool
上输出的内容:
Here's what it currently outputs with trimspool
on:
level 1(EOL)
level 2(EOL)
Some data(EOL)
这就是我想要的:
level 1(EOL)
level 2(EOL)
Some data(EOL)
推荐答案
我想你在追赶
set serveroutput on size 100000 format wrapped
如果我理解您的问题.
如果我这样做:
set serveroutput on size 1000000
begin
dbms_output.put_line('no indent');
dbms_output.put_line(' indent');
end;
/
SQL * Plus输出:
SQL*Plus outputs:
no indent
indent
但是,如果我这样做
set serveroutput on size 1000000 format truncated
begin
dbms_output.put_line('no indent');
dbms_output.put_line(' indent');
end;
/
SQL * Plus输出:
SQL*Plus outputs:
no indent
indent
您必须set trimspool on
才能消除直到eol
的空格.
You have to set trimspool on
in order to eliminate the spaces up to eol
.
这篇关于Oracle Trimpool仅尾随空格(不包括前导空格)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!