NLS_CHARACTERSET is used for CHAR, VARCHAR2, CLOB columns and NLS_NCHAR_CHARACTERSET is used for NCHAR, NVARCHAR2, NCLOB columns.
One can find the value of NLS_NCHAR_CHARACTERSET used by the database by running the following SQL:
select value from NLS_DATABASE_PARAMETERS where parameter=’NLS_NCHAR_CHARACTERSET’;
The possible values for NLS_NCHAR_CHARACTERSET can be UTF8 or AL16UTF16.
One can use the following v$nls_parameters view to find the database LANGUAGE, TERRITORY and CHARACTER SET.
select DECODE(parameter, 'NLS_CHARACTERSET', 'CHARACTER SET',
'NLS_TERRITORY', 'TERRITORY') name,
value from v$nls_parameters
WHERE parameter IN ( 'NLS_CHARACTERSET', 'NLS_LANGUAGE', 'NLS_TERRITORY')
CHARACTER SET WE8ISO8859P1
export NLS_LANG=<language>_<territory>.<character set>
Last updated: 17-Nov-2008
When exporting/importing one can minimize risk of losing data during import/export by setting NLS_LANG.
– Before starting export set NLS_LANG to be the same character set of the database being exported which means no conversion takes place, all the data will be stored in the export file as it was stored in the database.
– Before starting import set NLS_LANG to be the same value as the it was set during export which means no conversion will take place in the import session, but if the character set of the target database is different the data will automatically be converted when import inserts the data in the database.
– Before starting export set NLS_LANG to be the same character set of the database being imported to which means conversion takes place at this step it will automatically convert during export.
– Before starting import set NLS_LANG to be the same value as the it was set during import which means no conversion will take place as it was already converted during export.
Example: export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
Setting NLS_LANG tells Oracle what characterset the client is using so Oracle can do conversion if needed from client’s characterset to the database characterset and setting this parameter on the client does not change the client’s characterset. Setting Language and Territory in NLS_LANG has nothing to do with storing characters in database, it’s controlled by the characterset and of course if the database can store that characterset.
To check session NLS session parameters, note this doesn’t return the characterset set by NLS_LANG
SELECT * FROM NLS_SESSION_PARAMETERS;
SELECT USERENV ('language') FROM DUAL;
To find the NLS_LANG of your database one can run the following SQL:
SQL> SELECT * from NLS_DATABASE_PARAMETERS WHERE parameter IN ( 'NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET');
To get the possible value for language, territory and characterset you can check the view V$NLS_VALID_VALUES.
— parameter – possible values LANGUAGE, TERRITORY, CHARACTERSET
SELECT parameter, value FROM V$NLS_VALID_VALUES;
To change the client language
To change the client territory
To change the client characterset
For SQL*Plus to process french accents characters when using SQL*Plus, you would need to set NLS_LANG
On Unix (ksh)
Now when you start SQLPlus from Unix or Windows it will keep the accents on the french characters.