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: VARCHAR2 and trailing spaces - what's going on!

Re: VARCHAR2 and trailing spaces - what's going on!

From: dnh <nigel.hurst_at_food.ds-s.com>
Date: Mon, 30 Sep 2002 12:02:35 GMT
Message-ID: <3d983d0e.12979312@139.121.16.43>


On Mon, 30 Sep 2002 10:42:35 GMT, Kenneth Koenraadt wrote:

Hi Kenneth, Richard

I know what it does and, in a way, why; but I'm sure I've read in many places that varchar2s strip off spaces - am I imagining that detail or is some documentation in error???

nigel

>Hi Nigel,
>
>You have already discovered the fact - it does not strip trailing
>spaces when inserting. Better trust your own eyes.
>
>a) Inserting 'Hello world ' into a varchar2(100) takes up 16
>chars. That's good, because sometimes you reallly need to store
>trailing blanks.
>
>b) Inserting 'hello world' into a varchar2(100) will take up 11 chars.
>Whereas inserting 'hello world' into char(100) will take up 100 chars
>= 11 chars + 89 trailing blanks. In this sense, varchar2(n) "strips"
>trailing blanks in opposition to char(n). But that is not to be
>confused with a)
>
>
>- Kenneth Koenraadt
>
>
>
>
>
>
>On Mon, 30 Sep 2002 10:05:31 GMT, nigel.hurst_at_food.ds-s.com (dnh)
>wrote:
>
>>Now then
>>
>>I have always thought that when you insert a string into a varchar2
>>column any trailing spaces would be stripped off but am discovering
>>that this is not so.
>>
>>being a child of the net I then did a quick search to find both
>>situations described as true - it does strip trailing spaces and it
>>doesn't !!!!!!
>>
>>I'm so confused and , well, confused - what is the truth, somebody
>>help.
>>
>>cheers
>> nigel
>>-------------------------------------------------
>>Take out food to reply to nigel.hurst_at_food.ds-s.com
>>-------------------------------------------------
>



Take out food to reply to nigel.hurst_at_food.ds-s.com
Received on Mon Sep 30 2002 - 07:02:35 CDT

Original text of this message

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