Вы находитесь на странице: 1из 12

Lesson 12

Using Globalization Support


Objectives

Copyright © 2007, Oracle. All rights reserved.


Objectives

After completing this lesson, you should be able to do the


following:
• Identify how to obtain globalization support configuration
information.
• Customize language-dependent behavior for the
database and for individual sessions.
• Specify different linguistic sorts for queries.
• Use datetime datatypes.
• Query data using case-insensitive and accent-insensitive
sorting.

I-2 Copyright © 2007, Oracle. All rights reserved.


NLS Data Dictionary and Dynamic Performance
Views
The National Language Support Runtime Library (NLSRTL) is a multi-platform,
multilingual library that provides consistent globalization support behavior
throughout Oracle products. Commonly known as NLS, this library accounts for
local settings related to language, territory, and character set definitions, and
ensures that applications adhere to user location settings and cultural conventions.
NLS values are stored in memory and in the data dictionary.
You can query data dictionary and dynamic performance views to retrieve NLS
globalization support values.

I-3 Copyright © 2007, Oracle. All rights reserved.


Customize Language-Dependent Behavior

NLS_LANG
The initialization parameter NLS_LANG defines client language-specific
behavior, and its value cascades to those of the parameters
NLS_LANGUAGE, NLS_TERRITORY, and NLS_CHARACTERSET to
define the client language, territory, and character set. The value of
NLS_LANG is derived from the language selection made during Oracle
installation and becomes a read-only option. However, its value can be
changed with the NLS_LANGUAGE
parameter at the operating system environment level.

The values of NLS_LANGUAGE, NLS_TERRITORY, and most other NLS


parameters can be established separately from that of NLS_LANG, both on
the client and the server, to further customize data formatting. Setting
client-side values for these parameters with an ALTER SESSION statement
establishes a higher priority in determining NLS behavior at the session
level than server-side values.

I-4 Copyright © 2007, Oracle. All rights reserved.


Customize Language-Dependent Behavior
NLS Parameter Prioritization

The method by which an NLS parameter is set determines the priority of


the value and the
scope to which the value is applied.

I-5 Copyright © 2007, Oracle. All rights reserved.


Specify Different Linguistic Sorts for Queries

Linguistic Sort
Binary sorting returns queried data sorted by the numerical value of characters.
While binary sorting is faster than other sort types for English alphabet characters, its
results become unreliable when data includes multilingual characters.
Oracle provides a linguistic sorting function, which is triggered by setting the value of
the NLS_SORT parameter to a valid NLS_LANGUAGE value in a query statement,
to accurately sort data according to language-specific character conventions.
Linguistic sorting replaces generic numerical values with those that reflect each
character’s proper linguistic order, resulting in a character sort order that more
accurately reflects the native order for different languages.
Oracle provides two types of linguistic sorting methods: monolingual and multilingual.

NLS_COMP
The NLS_COMP parameter can be used in conjunction with NLS_SORT to ease the
specification of linguistic sorts. An NLS_COMP value of ANSI forces Oracle to use
linguistic sorting by default in the language specified by the value of the NLS_SORT
parameter.

I-6 Copyright © 2007, Oracle. All rights reserved.


Use Datetime Datatypes
Datetime Datatypes
Datetime datatypes are a standard set of Oracle initialization parameters that specify local date,
time stamp, and time zone values in order to customize globalization settings and synchronize
transactions that take place across multiple locales. Datetime values can be established using the
TO_TIMESTAMP, TO_TIMESTAMP_TZ, or TO_DATE functions, or by inserting literal datetime
values into a data set.

I-7 Copyright © 2007, Oracle. All rights reserved.


Query Data Using Case-Insensitive and Accent-
Insensitive Sorting
Case-Insensitive and Accent-Insensitive Sorting

By default, Oracle analyzes differences in character case and accents when


sorting data. In order to ignore such character features in data comparison
and sort operations, you can specify that they be carried out as case-
insensitive or accent-insensitive operations. When defining a sort value with
the NLS_SORT parameter, adding the suffix _CI to the value causes Oracle
to ignore character case in sort operations, and the value suffix _AI causes
sort operations to ignore both accents and case.

ALTER SESSION SET NLS_SORT=<value>_CI;


ALTER SESSION SET NLS_SORT=<value>_AI;

I-8 Copyright © 2007, Oracle. All rights reserved.


Practice Overview Lesson 12
Perform activities on the following pages:
• Activity 12-2: Page Number 242 – 243
• Activity 12-3: Page Number 245 – 247
• Activity 12-3: Page Number 249 – 253

I-9 Copyright © 2007, Oracle. All rights reserved.


Summary

In this lesson, you should have learned how to:


• Identify how to obtain globalization support
configuration information.
• Customize language-dependent behavior for the
database and for individual sessions.
• Specify different linguistic sorts for queries.
• Use datetime datatypes.
• Query data using case-insensitive and accent-
insensitive sorting.

I - 10 Copyright © 2007, Oracle. All rights reserved.


I - 11 Copyright © 2007, Oracle. All rights reserved.
I - 12 Copyright © 2007, Oracle. All rights reserved.

Вам также может понравиться