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

About the NLS_LENGTH_SEMANTICS Parameter

Specifies: Length semantics for columns of the character data types CHAR, VARCHAR2, and LONG; that is, whether these columns are specified in bytes or in characters. (Applies only to columns that are declared after the parameter is set.)

Acceptable Values:

Default Value: BYTE

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_LENGTH_SEMANTICS Affects Storage of VARCHAR2 Column

  1. Note the current values of NLS_LENGTH_SEMANTICS.

    For instructions, see "Viewing NLS Parameter Values".

  2. If the value of NLS_LENGTH_SEMANTICS in step 1 is not BYTE, change it:

    ALTER SESSION SET NLS_LENGTH_SEMANTICS=BYTE;
    
  3. Create a table with a VARCHAR2 column:

    CREATE TABLE SEMANTICS_BYTE(SOME_DATA VARCHAR2(20));
    
  4. Click the tab Connections.

    The Connections pane shows the connection hr_conn.

  5. Expand hr_conn.

    A list of schema object types appears, including Tables.

  6. Expand Tables.

    A list of tables appears, including SEMANTICS_BYTE.

  7. Select SEMANTICS_BYTE.

    To the right of the Connections pane, the Columns pane shows that for Column Name SOME_DATA, the Data Type is VARCHAR2(20 BYTE).

  8. Change the value of NLS_LENGTH_SEMANTICS to CHAR:

    ALTER SESSION SET NLS_LENGTH_SEMANTICS=CHAR;
    
  9. Create another table with a VARCHAR2 column:

    CREATE TABLE SEMANTICS_CHAR(SOME_DATA VARCHAR2(20));
    
  10. In the Connections pane, click the Refresh icon.

    The list of tables now includes SEMANTICS_CHAR.

  11. Select SEMANTICS_CHAR.

    The Columns pane shows that for Column Name SOME_DATA, the Data Type is VARCHAR2(20 CHAR).

  12. Select SEMANTICS_BYTE again.

    The Columns pane shows that for Column Name SOME_DATA, the Data Type is still VARCHAR2(20 BYTE).

  13. Set the value of NLS_LENGTH_SEMANTICS to the value that it had in step 1.

Related Topics

Oracle Database Globalization Support Guide

About Length Semantics

Changing NLS Parameter Values