Oracle trimspool only trailing spaces (non-leading spaces)

I am wondering if there are any tricks to get trimspool to only trim trailing spaces to the right.

I have code that uses dbms_output.put_line to print to the console, and there is often indentation in the output to make eye scanning easier. I set the line width to be quite large to make the output part easier to read, so I also set trimspool to get rid of the extra space. The only problem is that now the leading space is deleted just like trailing spaces. Is there any way to fix this? I could add a leading (before leading space) character " . " In some of the output statements, but I am not allowed to change the code in most packages.


Here it is output without trimmimg:

  level 1 (EOL)
      level 2 (EOL)
        Some data (EOL)

Here it outputs with trimspool on:

  level 1 (EOL)
 level 2 (EOL)
 Some data (EOL)

Here is what I want:

  level 1 (EOL)
      level 2 (EOL)
        Some data (EOL)
+6
oracle sqlplus
source share
1 answer

I think you are after

 set serveroutput on size 100000 format wrapped 

if i 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:

 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:

 no indent indent 

You must set trimspool on to remove the spaces before eol .

+8
source share

All Articles