Re: DBMS_OUTPUT

From: Jurij Modic <jmodic_at_src.si>
Date: Mon, 13 Jul 1998 13:28:30 GMT
Message-ID: <35aa080f.25378241_at_news.siol.net>


On 10 Jul 1998 15:23:57 GMT, stevec_at_zimmer.csufresno.edu (Steve Cosner) wrote:

>In article <6ndtuc$jdh$1_at_alexander.INS.CWRU.Edu>,
>Dennis M. Hancy <dw724_at_cleveland.Freenet.Edu> wrote:
>>How does one print a blank line using DBMS_OUTPUT?
>>I tried this:
>> DBMS_OUTPUT.PUT_LINE(' ');
>>but it didn't work. Any ideas? Thanks.
>>Dennis Hancy
>
>DBMS_Output seems to wipe out all leading spaces in a line, so I
>usually write a small procedure to insert a period or something else
>as the first character if the string I'm trying to print has a leading
>space. But I've never tried to print a blank line.
>
>This seems to work--but for me it prints two blank lines: print a
>chr(10), which should be a "line feed" character.
> dbms_output.put_line(chr(10));
>
>Trying chr(0) gives me one blank line. But that may be dependent upon
>what platform your are running on.

If you are doing this from SQL*Plus then you might consider setting the following:

SET SERVEROUTPUT FORMAT WRAPPED Using this setting you'll prevent DBMS_OUTPUT.PUT_LINE to trim the leading spaces. It also enables you to print empty lines without the need to provide any special characters (CHR(10), CHR(0), ....). See the example:

SQL> set serveroutput on format
Usage: SET SERVEROUTPUT { ON | OFF } [SIZE n]

             [ FOR[MAT] { WRA[PPED] | WOR[D_WRAPPED] | TRU[NCATED] } ] SQL> SET SERVEROUTPUT ON SIZE 10000 FORMAT WRAPPED SQL> EXEC DBMS_OUTPUT.PUT_LINE('12345abc'); 12345abc

PL/SQL procedure successfully completed.

SQL> EXEC DBMS_OUTPUT.PUT_LINE(' 45abc');

   45abc

PL/SQL procedure successfully completed.

SQL> EXEC DBMS_OUTPUT.PUT_LINE('');
    <== (This is empty line, made by DBMS_OUTPUT !)

PL/SQL procedure successfully completed.

SQL> This FORMAT stuff for SET SERVEROUTPUT is available in SQLPLUS 3.3, I'm not sure about 3.2, it is definitely not available in 3.1.

>Regards,
>Steve Cosner
>http://members.aol.com/stevec5088

Regards,

--
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 Mon Jul 13 1998 - 15:28:30 CEST

Original text of this message