Re: char vs varchar2

From: <sybrandb_at_my-deja.com>
Date: 2000/06/30
Message-ID: <8ji6im$5vc$1_at_nnrp1.deja.com>#1/1


In article <i6475.298$Mb4.4252010507_at_news.euroconnect.net>,   "Søren Junk" <sojudk_at_ifsas.dk> wrote:
> The basic difference between char and varchar2 is, that a varchar2
 only
> takes up the space it needs, and a char takes up the whole length
 (trailing
> spaces are added).
>
> This means that if you have an empty string, the varchar2 will treat
 it as
> an empty string, but a char will treat is a a number of spaces.
>
> Regards
>
> Søren Junk

This is true but only half of the story. The varchar2 has 2 length bytes, AFAIK the char doesn´t include a length byte. So an empty varchar2(1) will take up more space than a char(1).

Regards,

>
> gi <gi_at_england.com> wrote in message
> news:nlZ65.2368$Dr3.145427_at_monolith.news.easynet.net...
> > Can someone tell me ...but who really knows
> > if I have filled with length is there any difference if I use char
 (1) or
> > varchar2(1)
> > I read somewhere that char is there only because COBOL programs but
 I'm
 not
> > sure is that true
> > Thanks
> >
> >
>
>

--
Sybrand Bakker, Oracle DBA

All standard disclaimers apply
------------------------------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Jun 30 2000 - 00:00:00 CEST

Original text of this message