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: Pros and Cons of using Char and Varchar2

Re: Pros and Cons of using Char and Varchar2

From: Norberto Pontt O. <npontt_at_terra.cl>
Date: Thu, 5 Apr 2001 13:28:54 -0500
Message-ID: <AW1z6.7257$z71.122983@maule>

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 Received on Thu Apr 05 2001 - 13:28:54 CDT

Original text of this message

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