1. To store variable length UNICODE character values or national character se.
2. Max size is 4000 bytes or chars.
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 NVARCHAR2 is a
Unicode-only data type.
2.
When
you create a table with an NVARCHAR2 column, you
must specify the column length as size characters, or more precisely, code points in the
national character set.
3. 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.
4.
Oracle
stores a character value in an NVARCHAR2 column exactly
as you specify it, without any blank-padding, provided the value does not
exceed the length of the column.
5. If you try to insert a value that exceeds the specified length, then Oracle returns an error.
The minimum value of size is 1. The maximum value is:
Ø
16383
if MAX_STRING_SIZE = EXTENDED and the
national character set is AL16UTF16
Ø
32767
if MAX_STRING_SIZE = EXTENDED and the
national character set is UTF8
Ø
2000
if MAX_STRING_SIZE = STANDARD and the
national character set is AL16UTF16
Ø
4000
if MAX_STRING_SIZE = STANDARD and the
national character set is UTF8
6.
Independently
of the maximum column length in characters, the absolute maximum length of any
value that can be stored into an NVARCHAR2 column is 32767
or 4000 bytes, depending on MAX_STRING_SIZE.
7. For example, even if you define the column length to be 16383 characters, Oracle returns an error if you try to insert a 16383-character value but the national character set is UTF8 and all code points are 3 bytes wide.
8. The value of size is a length constraint, not guaranteed capacity.
9. If you want an NVARCHAR2 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 10922, if MAX_STRING_SIZE = EXTENDED, or 1333, if MAX_STRING_SIZE = STANDARD