Re: PL/SQL or me -- which one is more stupid?

From: Pauli Salmu <p.salmu_at_mn.medstroms.se>
Date: 1995/09/24
Message-ID: <44407f$59p_at_zorn.mnet.medstroms.se>#1/1


frampton_at_admin.flarc.edu.on.ca (Steve Frampton, Computer Operator/Systems Clerk) wrote:
>
> Hello:
>
> I am writing a calendar-generating application in PL/SQL. I would really
> like to know why the following code generates two very different results:
>
> --- begin ---
> set serveroutput on;
>
> declare
> test varchar2(29);
> begin
> test:='';
> for i in 1..7 loop
> test := test||' '||'|'; /* 3 spaces */
> end loop;
>
> dbms_output.put_line(test);
>
> test:='';
> for i in 1..7 loop
> test := test||'***'||'|'; /* 3 stars */
> end loop;
>
> dbms_output.put_line(test);
>
> end;
> /
>
> set serveroutput off;
> --- end ---
>
> And, here is the output:
>
> --- begin ---
> | | | | | | |
> ***|***|***|***|***|***|***|
> --- end ---
>
> This all seems pretty silly, to me. Any ideas?
>

It's as simple as it looks: put_line strips leading spaces. You can use some other blank character in the beginning of the line, preferably produced with function CHR to make the code readable. Received on Sun Sep 24 1995 - 00:00:00 CEST

Original text of this message