Re: VARCHAR2

From: <roosens>
Date: 1996/07/29
Message-ID: <4tjcqp$1e84_at_news-s01.ny.us.ibm.net>#1/1


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 Received on Mon Jul 29 1996 - 00:00:00 CEST

Original text of this message