Skip navigation.

oldwain随便写 on MyOpera

也许你还不知道 - sqlplus的小秘密(1)

有没有为了dbms_output.put_line会"吃掉"最前面的空格而苦恼?
scott@O9I.US.ORACLE.COM> set serveroutput on
scott@O9I.US.ORACLE.COM> exec dbms_output.put_line('   abc');
abc

PL/SQL procedure successfully completed.


(俺以前曾经很苦恼.为了保留空格, 尝试了加".", 加不可见字符等办法, 不过终究觉得不自然)
实际上, 只要在set serveroutput on后加上format wrapped参数, 就可以避免这个问题

scott@O9I.US.ORACLE.COM> set serveroutput on format wrapped
scott@O9I.US.ORACLE.COM> exec dbms_output.put_line('   abc');
   abc

PL/SQL procedure successfully completed.
July 2009
S M T W T F S
June 2009August 2009
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31