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(1) vs CHAR(1)

Re: VARCHAR2(1) vs CHAR(1)

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Mon, 29 Jul 2002 21:54:30 +0100
Message-ID: <3D45AB86.42A7@yahoo.com>


Stjepan Brbot wrote:
>
> If I change VARCHAR2(1) into CHAR(1) column type in table, what could
> happened? Will the application (expecting the VARCHAR2(1) column type)
> work correctly anymore by automatically converting the value from
> CHAR(1) into VARCHAR2(1) type?
>
> --
>
> Stjepan Brbot
>
> "Marco Muracchioli" <reply.on_at_group.please> wrote in message
> news:aqP09.129764$Jj7.2997288_at_news1.tin.it...
> > Hi,
> >
> > you should use char type if you need to store 1 or 2 char in the
> field.
> > Consider that varchar types need, phisically, more information than a
> simple
> > char type (such as size).
> > If you know that the field always contains null or 1 character (null
> or 2
> > characters for char(2)), char is the cheapest and fast solution.
> > "Fast" include the more speed than the DBMS need to organize and
> manage a char
> > data, because it always know the exact size and never need to
> calculate it.
> >
> > Marco
> >
> >

You'll find that char(n) and varchar2(n) are implemented (ie stored) in exactly the same way, ie, length and data are stored. The argument between them is if you want the data padded out with spaces (which I would say is rare unless you have a requirement for fixed length rows to improve storage management)

hth
connor

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Mon Jul 29 2002 - 15:54:30 CDT

Original text of this message

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