Re: VARCHAR2

From: S.M.Victor <SMVICTOR_at_concentric.net>
Date: 1996/08/08
Message-ID: <4ud81l$f53_at_herald.concentric.net>#1/1


roosens wrote:

>hangyk_at_singnet.com.sg (Jason Hang) wrote:
>>Gregory R Mattes <mattes+_at_andrew.cmu.edu> wrote:
>>> let me begin by saying that i'm a relative novice, if anyone can point
>>>me to the FAQ for this group (if one exists) i'd be very grateful.
 

>>> I have a question concerning the VARCHAR2 datatype. i have a
>>>reference book that tells me that there is no penalty for declaring a
>>>large maximum value for a VARCHAR2 and storing a relatively small string
>>>in it. it says that the largest length of a VARCHAR2 is 2000
>>>characters. my question is this: why not simply declare all string
>>>columns as VARCHAR2( 2000 ) ??
 

>>> is this in fact the popular way to do things? if not, why? is there
>>>a speed hit incurred in searches involving VARCHAR2's as compared with
>>>fixed width CHAR's? why do fixed with CHAR's exist if there is no
>>>penalty for using VARCHAR2's?
>>
>>I don't know about the penalties for declaring CHAR and VARCHAR2.
>>But I can sure tell you that it sure pays to be consistent.
>>I have a lot of problems when comparing variables and columns when
>>both are not of the same type, be it CHAR or VARCHAR2.
>>The best is to stick to one of them, and by rightfully... stick to
>>VARCHAR2 as recommended.
>>
>>
>>
>>
>>Thank You.
>>
>>Jason Hang.
>>
>>
 

>I can confirm this answer and add:
 

>the difference is to be seen when comparing trailing spaces :
 

>'ABC ' = 'ABC' with VARCHAR2

There is a penalty of allocating extra space whenever the size of the value in VARCHAR2 field grows ( during updates ).

No such penalty for CHAR fields.

No idea how bad it is in oracle. Wish Oracle manuals give more details about it. Received on Thu Aug 08 1996 - 00:00:00 CEST

Original text of this message