Setting NLS_LANG for Oracle

NLS_LANG=<language>_<territory>.<character set>
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');

PARAMETER VALUE
—————————— —————————————-
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CHARACTERSET WE8MSWIN1252

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
export NLS_LANG=BELGIUM_.WE8ISO8859P1
To change the client territory
export NLS_LANG=_BELGIUM.WE8ISO8859P1
To change the client characterset
export NLS_LANG=.AL32UTF8

8 thoughts on “Setting NLS_LANG for Oracle

    • Dear Asad

      Can you help writing what parameters settings are required to enable oracle form6i & DB10g to accept and show URDU language too.

  1. Plea help me iam importing dmp file into oracle 10g, but i can get this message and am not getting data into my system..
    plea tel me wat can i do

    Export file created by EXPORT:V10.02.01 via conventional path
    import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    Import terminated successfully without warnings.

    • I don’t think the reason why you are not getting data is not related to setting of NLS_DATA, You may want to check the arguments being passed to import.

  2. Hi,

    11.2.0.7.0 on linux.

    My database setting

    SQL> SELECT * from NLS_DATABASE_PARAMETERS WHERE parameter IN ( ‘NLS_LANGUAGE’, ‘NLS_TERRITORY’, ‘NLS_CHARACTERSET’);

    PARAMETER VALUE
    —————————— —————————————-
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CHARACTERSET WE8MSWIN1252

    Mine is a java based web application runs on weblogic.

    Please let me know what NLS_LANG I have to configure in the web.config file.

    Should it be NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252

    or
    NLS_LANG=AMERICAN_AMERICA.UTF8.

    Please clear my doubt.

    Also for reference please find my OTN question at

    https://forums.oracle.com/forums/thread.jspa?threadID=2331980&tstart=0

    Thanks in advance
    Girish

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s