Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: VARCHAR2(1) vs VARCHAR(2)

Re: VARCHAR2(1) vs VARCHAR(2)

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Sat, 13 Jan 2001 13:51:51 +0100
Message-Id: <10740.126616@fatcity.com>


Wayne,

    AFAIK 'Oracle works better' with 2-char columns is a total fallacy. What is a varchar() ? Basically one (or three, depending on the first byte value) byte to give a length, followed by the actual string. The length of the actual string is totally irrelevant - well, I'd tend to favour strings under 255 chars over those over this limit but it's about all ... unless you want to get down to the word size on your machine but that would be hair-splitting, wouldn't it. Personally, I tend to use CHAR(1), not VARCHAR(1) - don't see the point in using two bytes where one is enough.

BTW, in doubt use functions dump() and vsize() to see what is really stored.

Regards,

Stephane Faroult
Oriole Corporatioon

Wayne S Bellefeuille wrote:

> Our group was told a while back (from a consultant) that whenever we have a
> character column with a length of 1, we should still define the column with a
> length of 2. The reason given was that "Oracle works better" with 2-character
> columns rather than 1-character columns.
>
> Therefore, there is a "standard" here to define our 1-character columns as
> VARCHAR2(2). I think this is very misleading to the users and I was wondering
> if there was any basis for this decision.
>
> I am assuming it is centered around the fact that CHAR(1) and CHAR(2) supposedly
> both take up the same amount of storage, but I am not sure.
>
> Anyone know anything about this subject? Any reason I should not change the
> "standard" to VARCHAR2(1) for 1-character columns?
>
> Wayne Bellefeuille
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Wayne S Bellefeuill
Received on Sat Jan 13 2001 - 06:51:51 CST

Original text of this message

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