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: char vs. varchar?

Re: char vs. varchar?

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Fri, 02 Feb 2001 19:33:09 +0800
Message-ID: <3A7A9AF5.26AA@yahoo.com>

David Fitzjarrell wrote:
>
> In our last gripping episode "John Smith" <john_at_smith.com> wrote:
> > Is there any reason to choose CHAR(1) over VARCHAR2(1)?
> >
> > Phil Carter.
> >
> > "Jim Kennedy" <kennedy-family_at_home.com> wrote in message
> > news:Y95e6.350392$U46.10584292_at_news1.sttls1.wa.home.com...
> > > Char - fixed length
> > > varchar - variable length
> > >
> > > use varchar.
> > > Jim
> > > "Tom Weng" <tomweng_at_home.com> wrote in message
> > > news:eS3e6.269797$hD4.65146495_at_news1.rdc1.mi.home.com...
> > > > Could somebody explain to me how Oracle store char datatype data
 vs.
 varchar
> > > > datatype internally?
> > > >
> > > > Whis is the pro/con in-term of performing update on a char column
 v.s
> > > > varchar column?
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
> Since Jim did such an excellent job of explaining the difference...
>
> There is overhead associated with VARCHAR2 fields, and for
> multicharacter columns this overhead is usually minimal relative to the
> length of the column. Since a VARCHAR2(1) column can hold, at most, one
> character the overhead to maintain this variable column width is
> unnecessary, in my opinion. I would rather choose a CHAR(1) column and
> live with the fixed storage than declare a VARCHAR2(1) column and,
> through some fluke of data in the record, migrate the row simply
> because I decided to update that VARCHAR2(1) column. True, that
> occurrence would be rare, for the most part, but it could happen.
>
> I believe it is wasted space to declare a VARCHAR2(1) column when a CHAR
> (1) will suffice.
>
> --
> David Fitzjarrell
> Oracle Certified DBA
>
> Sent via Deja.com
> http://www.deja.com/

I've not dumped blocks to prove it, but I'm pretty sure both CHAR and VARCHAR2 are stored in the same way, namely length byte(s) followed by data, so no space saving would be made.

HTH

-- 
===========================================
Connor McDonald
http://www.oracledba.co.uk (mirrored at
http://www.oradba.freeserve.co.uk)

"Some days you're the pigeon, some days you're the statue"
Received on Fri Feb 02 2001 - 05:33:09 CST

Original text of this message

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