Difference between VARCHAR2(10 CHAR) and NVARCHAR2(10)
The NVARCHAR2 datatype was introduced by Oracle for databases that want to use Unicode for some columns while keeping another character set for the rest of the database (which uses VARCHAR2). The NVARCHAR2 is a Unicode-only datatype.
One reason you may want to use NVARCHAR2 might be that your DB uses a non-Unicode character set and you still want to be able to store Unicode data for some columns without changing the primary character set. Another reason might be that you want to use two Unicode character set (AL32UTF8 for data that comes mostly from western Europe, AL16UTF16 for data that comes mostly from Asia for example) because different character sets won't store the same data equally efficiently.
Both columns in your example (Unicode VARCHAR2(10 CHAR)
and NVARCHAR2(10)
) would be able to store the same data, however the byte storage will be different. Some strings may be stored more efficiently in one or the other.
Note also that some features won't work with NVARCHAR2, see this SO question:
- Oracle Text will not work with NVARCHAR2. What else might be unavailable?
I don't think answer from Vincent Malgrat is correct. When NVARCHAR2
was introduced long time ago nobody was even talking about Unicode.
Initially Oracle provided VARCHAR2
and NVARCHAR2
to support localization. Common data (include PL/SQL) was hold in VARCHAR2
, most likely US7ASCII
these days. Then you could apply NLS_NCHAR_CHARACTERSET
individually (e.g. WE8ISO8859P1
) for each of your customer in any country without touching the common part of your application.
Nowadays character set AL32UTF8
is the default which fully supports Unicode. In my opinion today there is no reason anymore to use NLS_NCHAR_CHARACTERSET
, i.e. NVARCHAR2
, NCHAR2
, NCLOB
. Note, there are more and more Oracle native functions which do not support NVARCHAR2, so you should really avoid it. Maybe the only reason is when you have to support mainly Asian characters where AL16UTF16
consumes less storage compared to AL32UTF8
.