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: VARCHAR2 vs. CHAR

Re: VARCHAR2 vs. CHAR

From: Lando <MarkL_at_quebim.com>
Date: 1997/12/10
Message-ID: <348F0227.91DF63EB@quebim.com>#1/1

Leave them as varchar2. Unless we are talking strictly about fixed length fields, varchar2 should take up less storage than a char datatype. For example, say we have two columns: c1 char(12),
c2 varchar2(12)
Now insert 'ABCD' into both. Column c1 stores the value with blank pads to the right of
the value up the the size specified, so, c1 looks like 'ABCD '. Column c2 just stores the value with no blank fills, so, c2 looks like 'ABCD'.
In this example c1 has used 12 bytes of space vs 4 bytes for c2 (assuming single byte character set). You can verify this by using the vsize function.

Roy Chang wrote:

> Hello everbody,
>
> I had heard that if I set a field to VARCHAR2(XX), XX being less than
> 35 or
> so, that it wouldn't save any space or make a difference. Is this
> correct?
> And if so, should I change the fields that are VARCHAR2 and less than
> 35 to
> CHAR(XX)?
>
> Any comments would be appreciated.
>
> Thanks in advance,
>
> Roy.
Received on Wed Dec 10 1997 - 00:00:00 CST

Original text of this message

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