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

Home -> Community -> Usenet -> c.d.o.misc -> Re: varchar2 data type

Re: varchar2 data type

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Sat, 16 Jul 2005 13:31:21 +0200
Message-ID: <dbar5e$2mn$03$1@news.t-online.com>


khatri wrote:
> hi every body,
> We can define a variable as varchar2(20 CHAR) and as varchar2(20 BYTE).
> can any body tell me the difference between the two in terms of storage
> of data in such a variable. i.e. how the oracle internally stores the
> value in both the cases?
>
> thanx.
>

The difference come up only by using of multibyte characterset - so you may need more than one byte to represent some characters. Of course, independent of definition varchar2(20 char) or varchar2(20 byte) the single character takes the same amount of space , it depends only on character set. Assume, you have a string of 17 character which in UTF8 are represented by 26 bytes. In that case you will be able to insert this string into column defined as varchar2(20 char) but not able to do it into varchar2(20 byte). If you however have a string of 7 characters represented by 13 bytes, then you can insert in both cases and in both cases it will be stored in datablock occupying 13 bytes.

Best regards

Maxim Received on Sat Jul 16 2005 - 06:31:21 CDT

Original text of this message

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