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: Storage requirements of NCHAR columns

Re: Storage requirements of NCHAR columns

From: Ross <rossfreemantle_at_yahoo.co.uk>
Date: 10 Jul 2006 09:59:49 -0700
Message-ID: <1152550789.496543.170560@35g2000cwc.googlegroups.com>

Kenneth wrote:
> On 10 Jul 2006 06:42:24 -0700, "Ross" <rossfreemantle_at_yahoo.co.uk>
> wrote:
>
> >Hi.
> >
> >I have a question regarding the storage of NCHAR values. Suppose I'm
> >using UTF8 as the national character set and I define a table as
> >follows:
> >
> >CREATE TABLE table1 (column1 NCHAR(30));
> >
> >My question is, what exactly does the 30 mean? Is it 30 code units or
> >30 characters?
> >
> >The Globaliztion Support Guide seems to suggests the former, which
> >would imply that the column can store a maximum of 30 bytes. However,
> >it then goes on to suggest that that the column has a maximum capacity
> >of 90 bytes (30 3-byte characters).
> >
> >It seems to be contradicting itself. What am I missing?
> >
> >Thanks in advance.
> >
>
> Feel free to give version and platform next time.......
>
> From the online doc (9i/10g) :
> "NCHAR, NVARCHAR2, CLOB, and NCLOB columns are always character-based"
>
> So the answer is that it can hold 30 chars, regardless what NCHARSET
> you are using.
>
> With CHAR/VARCHAR datatypes you can vary between BYTE and and CHAR
> semantics through the NLS_LENGTH_SEMANTICS init-parameter. With a
> single-byte database charset, there is no difference between BYTE and
> CHAR.
>
>
> - Kenneth Koenraadt

Sorry, I'm using Oracle 10g (Linux).

>From Chapter 6 of the Globalization Support Guide:

"When you use NCHAR and NVARCHAR2 datatypes for storing multilingual data, the
column size specified for a column is defined in number of characters. (The number of
characters means the number of Unicode code units.)"

This sould seem to suggest that the a NCHAR(30) column would actually require 30 bytes of storage (as UTF8 has a single-byte code unit). However, an example in Chapter 7 explicitly states that 90 bytes are required. I don't think the NLS_LENGTH_SEMANTICS parameter affects NCHAR, so which is correct? Received on Mon Jul 10 2006 - 11:59:49 CDT

Original text of this message

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