Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Pros and Cons of using Char and Varchar2
You are right...
Char uses more space than varchar2 if there is some blanks left filling the
fields. Otherwise both data types should cost the same.
Norberto
"Connor McDonald" <connor_mcdonald_at_yahoo.com> escribió en el mensaje
news:3ACC5ED4.128F_at_yahoo.com...
> Norberto Pontt O. wrote:
> >
> > 1.-CHAR TYPE
> > Char type should be used for fixed length data.
> > Such as codes
> > A100
> > B102
> > B104
> > Cost: It uses more blocks in the space in tablespace
> > Benefits: No problems about Chained Rows
> >
> > 2.-VARCHAR2 TYPE
> >
> > Varchar2 stands for variable length data ( and for space saving)
> > Such as
> > Descriptions
> > Notes
> > Text explaining something about de record, etc.
> >
> > Cost: when varchar columns are updated they may be starting the feared
> > chained rows menace.
> > Benefits: it helps to save space in the tablespace assigned to the
table
> >
> > Which one is better? Its a matter of design. Here are some clues:
> > 1.-Use whatever one. It's up to you.
> > Try using only one type so that you avoid problems about comparing
varchar2
> > against char (in the where part of the query) and not having the problem
> > such as
> > 'SMITH' <>'SMITH '
> > 2.-Varchar2 produces the chained rows problem in the long trend. If the
> > development project is just starting, leave the problem for dba people
to
> > solve it in the far away future.
> > So if you want to save space use varchar2
> > 3.-If your system might be migrated to some other sql bearing rdbms
(other
> > than oracle) then CHAR type might be better because it is an older
standard.
> >
> > Well, that's all for today.
> > Good Luck
> >
> > "Peter Shankey" <shankeyp_at_its.charlestoncounty.org> escribió en el
mensaje
> > news:20010405.15264600_at_wando.charlestoncounty.org...
> > What are the issues why should I use one over the other.
> >
> > thanks
> > Pete
>
> If the data is fixed length, I'm not sure how CHAR uses more space,
> since both char and varchar2 are stored in the same way.
>
> Connor
> --
> ===========================================
> 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 Thu Apr 05 2001 - 15:46:17 CDT