Re: PL/SQL problem

From: Jurij Modic <jmodic_at_src.si>
Date: Sun, 22 Nov 1998 15:35:15 GMT
Message-ID: <365820ca.11650383_at_news.siol.net>


On Sun, 22 Nov 1998 14:29:23 +0800, Connor McDonald <mcdonald.connor.cs_at_bhp.com.au> wrote:

>Lisa F. Miller wrote:
>>
>> Try
>> dbms_output.put_line(' ');
>>
>> Alvin Huang wrote:
>>
>> > Hi,all
>> >
>> > I got a problem in PL/SQL
>> > how can I put an empty line ....
>> > I tried to use --- dbms_output.new_line,
>> > but it's useless
>> > is there any other functions that I can use to achieve the goal??
>> >
>> > Regards
>> >
>> > Alvin Huang,11/20
>
>I don't think this will work, leading spaces are stripped off using
>dbms_output.put_line
>
>SQL> set serveroutput on
>SQL> exec dbms_output.put_line(' Leading spaces');
>Leading spaces
>
>PL/SQL procedure successfully completed.
>
>SQL>
You can prevent triming leading spaces when using DBMS_OUTPUT in SQL*Plus by setting the FORMAT WRAPPED option with SET SERVEROUTPUT command. Consider the following example:

SQL> SET SERVEROUTPUT ON
SQL> EXEC DBMS_OUTPUT.PUT_LINE(' Leading spaces are striped off'); Leading spaces are striped off

PL/SQL procedure successfully completed.

SQL> SET SERVEROUTPUT ON FORMAT WRAPPED
SQL> EXEC DBMS_OUTPUT.PUT_LINE(' Leading spaces NOT stripped off');

   Leading spaces are NOT stripped off

PL/SQL procedure successfully completed.

SQL> Note also that with setting FORMAT WRAPPED you can output empty lines by using an empty string as parameter to PUT_LINE procedure:

SQL> BEGIN
  2 DBMS_OUTPUT.PUT_LINE(' First line');

  3     DBMS_OUTPUT.PUT_LINE('');   -- Seccond line is empty
  4     DBMS_OUTPUT.PUT_LINE('    Third line');
  5 END;
  6 /
    First line

    Third line

PL/SQL procedure successfully completed.

>--
>==============================================
>Connor McDonald
>BHP Information Technology
>Perth, Western Australia
>"The difference between me and a madman is that I am not mad"
> - Salvador Dali

HTH, Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Sun Nov 22 1998 - 16:35:15 CET

Original text of this message