January 22, 2009

National Languange Support a.k.a NLS

Filed under: Works

 

1. What is National Language Support?

National Language Support (NLS) is necessary for the following tasks:

  • Converting character sets between client and server
  • Supporting different languages
  • Region-dependent formatting of date and currency data
  • Sort sequence

2. What is Oracle Globalization Support?

Oracle Globalization Support is the new name for the National Language Support as of Oracle 9i.

3. What is a character set?

Internally, all characters on the computer (letters, figures, special characters) are represented by figures. Code pages on the operating system determine which character is represented by which figure.

Oracle also uses this kind of internal representation which is defined by character sets. You can therefore compare a character set to a code page which defines the Oracle-internal representation of characters.

4. Why do I need different character sets?

The number of characters that can be represented by a character set is limited. For example, you can only represent 2^8, that is, 256, different characters with an 8-bit character set. This number is not sufficient to represent all characters of all languages.

5. How many different characters can be represented by the character sets?

There are four groups of character sets:

  • 7-bit character sets (for example, US7ASCII): 2^7, that is, 128, characters can be represented.
  • 8-bit character sets (for example, WE8DEC): 2^8, that is, 256, characters can be represented.
  • Multibyte character sets (for example, KO16KSC5601): more than 256 characters can be represented
  • UNICODE character sets (for example, UTF8): In theory, over a million characters can be represented. -

6. What, from an Oracle point of view, is a proper setup of the character sets?

From an Oracle point of view, the following requirements should be met:

  • You should set up the Oracle database with a character set that supports all characters used by the application.
  • The Oracle clients should use a character set that matches the code page used in the operating system.

For example:

  • A Windows client with code page WIN1252 uses the WE8MSWIN1252 character set.
  • A UNIX client with code page ROMAN8 uses the WE8ROMAN8 character set.
  • The relevant database server is defined with the UTF8 character set that contains the characters of both client code pages.

7. How can I determine the character set used by a database?

On an open database, you can use the following SELECT to determine which character set the database is using:

SELECT VALUE FROM V$NLS_PARAMETERS
   WHERE PARAMETER = ‘NLS_CHARACTERSET’;

8. Where are the character set definitions stored?

 On the server, the character set definitions are written to

<oracle_home>/ocommon/nls/admin/data or for Oracle 10: <oracle_home>/nls/data

On the client, the character set definitions are stored as part of the client software installation. On Windows, the directory corresponds to the directory of the server installation. On UNIX, the files are unpacked in directories such as the following, depending on the release:

$ORACLE_HOME/ocommon/NLS_805/admin/data
/oracle/805_32/ocommon/nls/admin/data
/oracle/client/92x_64/ocommon/nls/admin/data

9. Which environment settings do I need for NLS?

The following environment variables play a role in conjunction with NLS:

  • NLS_LANG: Definition of the language, region and character set of the client (for example, AMERICAN_AMERICA.WE8DEC, see the information above);
  • ORA_NLS: Directory of the NLS files for Oracle 7.2;
  • ORA_NLS32: Directory of the NLS files for Oracle 7.3;
  • ORA_NLS33: Directory of the NLS files for Oracle 8.0 and higher;
  • ORA_NLS10: Directory of the NLS files for Oracle 10.

On WINDOWS, the ORA_NLS* variables must be set in the Registry and not in the environment.

10. Which character sets are known to the Oracle database?

You can use the following command to check which character sets are known to the Oracle database:

SELECT VALUE FROM V$NLS_VALID_VALUES
WHERE PARAMETER = ‘CHARACTERSET’;






















Get free blog up and running in minutes with Blogsome
Theme designed by Helga Cleve