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

Home -> Community -> Usenet -> c.d.o.server -> Re: rtrim question

Re: rtrim question

From: Jeff Guttadauro <jeff109_at_NOSPAM.netscape.net>
Date: Tue, 14 Dec 1999 14:55:33 GMT
Message-ID: <385658c5.1128342@news>


Hi, Peter.

        As Scott Patterson said in his post, it is just a column width issue. You can set it to something different if you like. The reason for the behavior you're seeing is this:

Since your first example does a select rtrim of a table column, it is possible that one of the values in the column could be the full length of the column. The column will be sized to account for that possibility. Oracle will not first look at all the values in the result set to figure out how to size the column output. Since your second example does a select rtrim of a string literal, it knows what it is dealing with right from the start, so it can make the proper column width adjustment.

HTH,
-Jeff

On Mon, 13 Dec 1999 17:05:45 -0500, Peter Shankey <shankeyp_at_charlestoncounty.org> wrote:

>
>What am I missed about the rtrim function:
>If I have a table
>SQL> describe delete_me1
> Name Null? Type
> ------------------------------- -------- ----
> C1 NOT NULL VARCHAR2(10)
>and do
>
>SQL> select c1 from delete_me1;
>
>C1
>----------
>t1
>
>I get t1 no big deal
>if I do
>SQL> select length(c1) from delete_me1;
>
>LENGTH(C1)
>----------
> 2
>
>again this makes sense length() counts chars up to a white space
>but if I do
>SQL>
>SQL> select rtrim(c1) from delete_me1;
>
>RTRIM(C1)
>----------
>t1
>
>why don't I see ????
>RT
>--
>t1
>
>In the case of using the dual table I get:
>
>SQL> select 't1 ' c1 from dual;
>
>C1
>----------
>t1
>
>SQL>
>SQL> select rtrim('t1 ') c1 from dual;
>
>C1
>--
>t1
>
>SQL>
>
>It seems like rtrim() is not treating the value returned from C1 in the
>table
>delete_me1 like it is not a string. but the length function is.
>How could I rtrim the return of a varchar2 column?
>
>Thanks
>Pete
>
>
>
Received on Tue Dec 14 1999 - 08:55:33 CST

Original text of this message

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