Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: i want to print in single line pl/sql block
> 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.comReceived on Tue Aug 28 2007 - 08:37:32 CDT