How to prevent dbms_output.put_line from trimming leading whitespace?

不问归期 提交于 2019-12-05 06:27:00

The problem is not with dbms_output but with SQL*Plus.

Use

SET SERVEROUTPUT ON FORMAT WRAPPED

or

SET SERVEROUTPUT ON FORMAT TRUNCATED

to preserve the spaces.


From the documentation (PDF) of SET SERVEROUT WORD_WRAPPED (which is the standard):

SQL*Plus left justifies each line, skipping all leading whitespace.

Joe

Might add that if you want to preserve the leading spaces but trim the trailing spaces use:

set trimspool on

This way the leading spaces will be preserved but the line length will be determined by the actual length of text in the output.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!