background image
<< Using Linguistic Sort and Search | Setting the NLS_COMP Parameter >>
<< Using Linguistic Sort and Search | Setting the NLS_COMP Parameter >>

Using the NLS_COMP Parameter

Establishing a Globalization Support Environment
Working in a Global Environment 6-23
Cabrio
Cambrault
Cambrault
Chen
Chung
Colmenares
6 rows selected
4.
Set
NLS_SORT
to
SPANISH_M
.
ALTER SESSION SET NLS_SORT=spanish_m;
5.
Enter the same
SELECT
statement, to check the output after the change.
SELECT last_name FROM employees
WHERE last_name LIKE 'C%'
ORDER BY last_name;
The output from the example should be similar to the following. Note that
Colmenares now comes before Chen.
LAST_NAME
-------------------------
Cabrio
Cambrault
Cambrault
Colmenares
Chen
Chung
6 rows selected
6.
Set
NLS_SORT
back to its original setting listed in Step 1. For example:
ALTER SESSION SET NLS_SORT=BINARY;
Using the NLS_COMP Parameter
When using comparison operators, characters are compared according to their binary
codes in the designated encoding scheme. A character is greater than another if it has a
higher binary code. Because the binary sequence of characters may not match the
linguistic sequence for a particular language, those comparisons might not be
linguistically correct.
The value of the
NLS_COMP
parameter affects the comparison behavior of SQL
operations. The value can be
BINARY
(default) or
LINGUISTIC
. You can use the
NLS_
COMP
parameter to avoid the cumbersome process of using the
NLSSORT
function in
SQL statements when you want to perform a linguistic comparison instead of a binary
See Also:
Oracle Database Reference for more information on the
NLS_SORT
parameter
Using the NLS_COMP Parameter
on page 6-23
Using Case-Insensitive and Accent-Insensitive Search
on
page 6-25
Oracle Database Globalization Support Guide for a complete
discussion of linguistic sort and string searching