1.
It is useful to store UNICODE character or
national character values with fixed
length.
2.
Max. size is 2000 chars/bytes.
3.
You specify the national character set
as either AL16UTF16 or UTF8 when you create your database.
AL16UTF16
and UTF8
1. AL16UTF16 and UTF8
are two encoding forms of the Unicode character set (UTF-16 and CESU-8,
correspondingly) and hence NCHAR
is a Unicode-only data type.
2. One code point has
always 2 bytes in AL16UTF16 and from 1 to 3 bytes in UTF8, depending on the
particular character encoded by the code point.
3. Oracle ensures that
all values stored in an NCHAR column have the
length of size characters.
4. If you insert a value that is shorter than the
column length, then Oracle blank-pads the value to the column length.
5.
If you try to insert a value that is too long
for the column, then Oracle returns an error. Note that if the national
character set is UTF8, blank-padding does not guarantee that all column values
have the same byte length.
6. You can omit size
from the column definition. The default value is 1.
7. The maximum value of size
is 1000 characters when the national character set is AL16UTF16, and 2000
characters when the national character set is UTF8.
8. However,
independently, the absolute maximum length of any character value that can be
stored into an NCHAR column is 2000 bytes.
9. For example, even if
you define the column length to be 1000 characters, Oracle returns an error if
you try to insert a 1000-character value but the national character set is UTF8
and all code points are 3 bytes wide.
10. The value of size is
a length constraint, not guaranteed capacity.
11. If you want an NCHAR column to be always able
to store size characters in both national character sets, use a value of size
that is less than or equal to 666.