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: David Fitzjarrell <oratune_at_aol.com>
Date: Fri, 02 Feb 2001 03:56:10 GMT
Message-ID: <95db4o$1mv$1@nnrp1.deja.com>

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/
Received on Thu Feb 01 2001 - 21:56:10 CST

Original text of this message

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