Your browser does not support JavaScript. This help page requires JavaScript to render correctly. About the NLS_COMP Parameter
Skip Headers
Previous
Previous
 
Next
Next

About the NLS_COMP Parameter

Specifies: Character comparison behavior of SQL operations.

Acceptable Values:

Default Value: BINARY

The following example shows that the result of a query can depend on the NLS_COMP setting.

To try this example in SQL Developer, enter the statements and queries in the SQL Worksheet. For information about the SQL Worksheet, see "Running Queries in SQL Developer". The results shown here are from SQL*Plus; their format is slightly different in SQL Developer.

NLS_COMP Affects SQL Character Comparison

  1. Note the current values of NLS_SORT and NLS_COMP.

    For instructions, see "Viewing NLS Parameter Values".

  2. If the values of NLS_SORT and NLS_COMP in step 1 are not SPANISH_M (Traditional Spanish) and BINARY, respectively, change them:

    ALTER SESSION SET NLS_SORT=SPANISH_M NLS_COMP=BINARY;
    
  3. *Run this query:

    SELECT LAST_NAME FROM EMPLOYEES
    WHERE LAST_NAME LIKE 'C%';
    

    Result:

    LAST_NAME                 
    ------------------------- 
    Cabrio                    
    Cambrault                 
    Cambrault                 
    Chen                      
    Chung                     
    Colmenares                
     
    6 rows selected
    
  4. Change the value of NLS_COMP to LINGUISTIC:

    ALTER SESSION SET NLS_COMP=LINGUISTIC;
    
  5. Repeat the query from step 3.

    Result:

    LAST_NAME                 
    ------------------------- 
    Cabrio                    
    Cambrault                 
    Cambrault                 
    Colmenares                
     
    4 rows selected
    

    This time, Chen and Chung are not returned because Traditional Spanish treats ch as a single character that follows c.

  6. Set NLS_SORT and NLS_COMP to the values that they had in step 1.

Related Topics

Oracle Database Globalization Support Guide

About Linguistic Sorting and String Searching

Changing NLS Parameter Values