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: <Kenneth>
Date: Mon, 30 Sep 2002 10:42:35 GMT
Message-ID: <3d98271d.11774941@news.capgemini.se>


Hi Nigel,

You have already discovered the fact - it does not strip trailing spaces when inserting. Better trust your own eyes.

  1. Inserting 'Hello world ' into a varchar2(100) takes up 16 chars. That's good, because sometimes you reallly need to store trailing blanks.
  2. 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
>-------------------------------------------------
Received on Mon Sep 30 2002 - 05:42:35 CDT

Original text of this message

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