Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: char vs varchar2
In article <slsg8fmhop3145_at_corp.supernews.com>,
"Matt B." <mcb_at_fightspam.sd.znet.com> wrote:
> "Thomas J. Kyte" <tkyte_at_us.oracle.com> wrote in message
> news:8jkv38$489$1_at_nnrp1.deja.com...
> >A 'small' character field is one that has a length of <= 250
characters.
> Anything else is considered as a 'long' character type.
>
> ??? (Confused...)
>
> What about VARCHAR2(2000) (Oracle 7 I believe) and VARCHAR2(4000)
(Oracle 8)
> datatypes/lengths that you can create as part of a table? And in
PL/SQL, a
> VARCHAR2 can be up to 32767 in length? These aren't called "LONG",
right?
> They're still some form of VARCHAR, aren't they?
>
Yes, -- they are all varchar.
If you have a varchar2(240) -- it'll be a "small" varchar2. If you have a varchar2(255) -- it'll be a "longer" varchar2.
Its the way they are physically stored on disk. A string <= 250 bytes takes its length + 1 byte to store. A string > 250 bytes takes its length + 3 bytes to store. thats all
didn't mean to confuse "longs" with "varchars > 250 bytes". There are "small" string and "big" strings.
> -Matt
>
> >
> > o Small Character
> >
> > 1 byte for column length, followed by the data. Eg,
> >
> > 03 nn nn nn
> >
> > o Long Character
> >
> > 1 flag byte to tell us its "big", the next two bytes are used to
> > store the *actual* length, and then followed by data. Eg,
> >
> > fe 01 34 nn nn nn
> >
> >
> > a char(1) and varchar2(1) are stored the same.
> >
> >
> > > >
> > > > gi <gi_at_england.com> wrote in message
> > > > news:nlZ65.2368$Dr3.145427_at_monolith.news.easynet.net...
> > > > > Can someone tell me ...but who really knows
> > > > > if I have filled with length is there any difference if I use
char
(1) or
> > > > > varchar2(1)
> > > > > I read somewhere that char is there only because COBOL
programs
but
I'm
not
> > > > > sure is that true
> > > > > Thanks
> > > > >
> > > > >
> > > >
> > > >
> > >
> > > --
> > > Sybrand Bakker, Oracle DBA
> > >
> > > All standard disclaimers apply
> > > ------------------------------------------------------------------
-- Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries Howtos and such: http://osi.oracle.com/~tkyte/index.html Oracle Magazine: http://www.oracle.com/oramag Opinions are mine and do not necessarily reflect those of Oracle Corp Sent via Deja.com http://www.deja.com/ Before you buy.Received on Sat Jul 01 2000 - 00:00:00 CDT
![]() |
![]() |