Language Support   «Prev  Next»

Lesson 2 How Oracle implements National Language Support
Objective Understand how Oracle supports Foreign Languages

How Oracle Implements National Language Support and Supports Foreign Languages

There are thousands of languages in active use worldwide, differing not just in vocabulary and grammar but in the alphabets and character sets used to write them. As a database used by organizations operating across borders, Oracle has to handle all of this at once — sometimes within a single table. Oracle's answer splits the problem into two independent halves: language-dependent data and language-independent access to that data.

  • Language-dependent Data — Once data is written to an Oracle database, it's stored as binary bytes according to a specific character set, chosen when the database was created. That character set is what lets Oracle represent English in a single byte per character, or Chinese and Japanese using multiple bytes per character, within the same storage engine. The character set is a property of the data, fixed at write time regardless of who later reads it.
  • Language-independent Functions and Access — How the data was stored is separate from how any individual user experiences the database. One user might need error messages in French while another, querying the exact same tables, needs them in Japanese. Oracle handles this by letting each session declare its own language preference independently — the same database can hand back messages, date formats, and sort orders in a dozen different languages simultaneously, all pointed at identical underlying data. The next lesson covers the specific parameters that control this at runtime.

How Oracle Implements National Language Support

Oracle's National Language Support (Globalization Support) framework is what makes both halves of that split work in practice. It spans character sets, locale-aware formatting, linguistic sorting, and translated messaging — each addressing a different part of the language problem.

Character sets and encoding. Oracle supports both single-byte character sets (useful for languages with small alphabets, like English or French) and multi-byte character sets (needed for Chinese, Japanese, Korean, and similar scripts). Unicode — specifically AL32UTF8, Oracle's UTF-8 implementation — is the practical default for new multilingual databases today, since a single Unicode-based character set can represent virtually every language's characters at once, removing the need to pick and manage separate charsets per region. The database character set governs CHAR, VARCHAR2, LONG, and CLOB storage; the separate national character set governs only NCHAR, NVARCHAR2, and NCLOB columns, and is chosen independently at database creation time specifically to guarantee Unicode storage for those columns even in a database whose main character set isn't Unicode.

Locale-specific settings. NLS parameters can be set at four different levels, from broadest to narrowest:
  • Database level — set via initialization parameters, applying as the default for the whole database.
  • Instance level — a default for sessions that don't specify their own value.
  • Session level — set with ALTER SESSION, controlling a single connection.
  • SQL statement level — a one-off override passed directly into a function call, such as supplying an explicit NLS_DATE_LANGUAGE argument to TO_CHAR without touching the session's default at all.
The most commonly touched parameters are NLS_LANGUAGE (messages and day/month names), NLS_TERRITORY (date, number, and currency conventions), NLS_DATE_FORMAT, NLS_CURRENCY, and NLS_SORT. You can see every NLS parameter's live value for your own session at once with:
SELECT parameter, value FROM v$nls_parameters ORDER BY parameter;

Linguistic sorting and comparison. A plain byte-order sort doesn't match how any given language actually alphabetizes text — in traditional Spanish collation, for instance, "ch" sorts as its own unit between "c" and "d," which binary comparison would never produce. Oracle's linguistic sorting (collation) applies these language-specific rules, and the collation used is controlled by NLS_SORT (for example BINARY, FRENCH, or SPANISH). To confirm which collation and language values are actually valid on your version — and whether any have been marked deprecated — query V$NLS_VALID_VALUES rather than assuming a name from older documentation still applies.

Date, time, and number formats. The same underlying date is displayed as DD/MM/YYYY in the UK and MM/DD/YYYY in the US; the same number uses a period or a comma as its decimal separator depending on locale. NLS_DATE_FORMAT, NLS_NUMERIC_CHARACTERS, and NLS_TIMESTAMP_FORMAT control these conventions independently of the data itself, which never changes — only its presentation does.

Error messages and the user interface. NLS_LANGUAGE also determines which language Oracle uses for its own error messages and other database-generated text, so two sessions hitting the identical error can see it reported in two different languages without any application-level translation logic involved.

Multilingual application support. Beyond the core parameters, Oracle has historically shipped additional tooling aimed at globalized application development — a Globalization Development Kit (GDK) of APIs and a Locale Builder for custom locale definitions among them. If you're relying on either by name, verify current availability and naming against the Oracle AI Database Globalization Support Guide for your release rather than older course material, since tooling in this space has shifted across Oracle versions.

Data conversion. Migrating existing data to a different character set — most commonly, moving a legacy single-byte database to Unicode — is handled through ALTER DATABASE CHARACTER SET for compatible supersets, historically paired with a pre-migration scanning utility (CSSCAN in older releases) to check for data that wouldn't survive the conversion cleanly. On the client side, the NLS_LANG environment variable is what ensures bytes are converted correctly as they cross between a client's encoding and the database's.

Time zone support. For applications spanning multiple time zones, Oracle provides TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE data types, which store or normalize zone information alongside the timestamp itself rather than leaving zone handling entirely to the application layer.

Example
-- Set session-level NLS parameters
ALTER SESSION SET NLS_LANGUAGE = 'FRENCH';
ALTER SESSION SET NLS_TERRITORY = 'FRANCE';
ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY';

-- Query with locale-specific settings
SELECT TO_CHAR(SYSDATE, 'Day, DD Month YYYY') FROM DUAL;
-- Output: "Mardi, 11 Août 2026"
Taken together, these mechanisms let one Oracle database serve users in dozens of languages and regions simultaneously — each session sees its own language, formats, and sort order, while the underlying data stays exactly as it was written.

NLS_LENGTH_SEMANTICS

One parameter deserves closer attention on its own, since it directly affects how much storage multilingual columns actually need: NLS_LENGTH_SEMANTICS, which controls whether CHAR and VARCHAR2 column lengths are measured in bytes or in characters.
Property Description
Parameter type String
Syntax NLS_LENGTH_SEMANTICS = string
Example: NLS_LENGTH_SEMANTICS = 'CHAR'
Default value BYTE
Modifiable ALTER SESSION, ALTER SYSTEM
Modifiable in a PDB Yes
Range of values BYTE | CHAR
Basic No

The session-level value sets the default length semantics for VARCHAR2 and CHAR table columns, object attributes, and PL/SQL variables created in that session — existing columns are never affected retroactively, and an explicit BYTE or CHAR qualifier on a specific column always overrides the session default. NCHAR, NVARCHAR2, CLOB, and NCLOB columns are always character-based regardless of this setting. Sessions logged in as SYS don't use this parameter at all — they use BYTE semantics unconditionally unless a column definition says otherwise.

A word of caution: Oracle strongly recommends against setting NLS_LENGTH_SEMANTICS to CHAR at the instance or server parameter file level. Doing so can cause existing installation scripts — written assuming BYTE semantics — to unexpectedly create character-length columns, which has caused run-time errors including buffer overflows in practice. If character semantics are needed, apply them at the session or column level instead of globally.

In the next lesson, we'll look at the specific runtime parameters that put everything covered here into practice for a live connection.

SEMrush Software 2 SEMrush Banner 2