Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: i want to print in single line pl/sql block

Re: i want to print in single line pl/sql block

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Tue, 28 Aug 2007 08:37:32 -0500
Message-ID: <46d41913$0$16405$88260bb3@free.teranews.com>


> declare
> v number := 0;
> v1 number;
> begin
> for i in 1..10 loop
> for j in 1..i loop
> v:= v+j;
> dbms_output.put_line(j);

Change this to DBMS_OUTPUT.PUT so that it does not add a line-feed here.

> if j<>i then
> dbms_output.put_line(' + ');

Change this to DBMS_OUTPUT.PUT so that it does not add a line-feed here.

> end if;
> end loop;
> dbms_output.put_line(' = '||v);

Here is the end of your line, so you do want the PUT_LINE here.

> v:=0;
> end loop;
> end;
> /

Depending on your version, you may have to do SET SERVEROUTPUT ON in SQL*Plus before running the above so that you can see the output.

HTH,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown

-- 
Posted via a free Usenet account from http://www.teranews.com
Received on Tue Aug 28 2007 - 08:37:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US