How to Change NLS_LENGTH_SEMANTICS Temporarily

  • by

NLS_LENGTH_SEMANTICS

Let's see what NLS_LENGTH_SEMANTICS of the database currently set.

SQL> conn hr/hr@orclpdb
Connected.
SQL> show parameter semantics;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
nls_length_semantics                 string      CHAR

The current NLS_LENGTH_SEMANTICS is CHAR globally.

If your stored procedures heavily depend on BYTE to calculate string, you may consider to ask DBA to change the semantics to BYTE globally. If DBA refuses to change it for some reason, you can also change it temporarily, at session-time.

SQL> alter session set nls_length_semantics=BYTE;

Session altered.

SQL> show parameter semantics;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
nls_length_semantics                 string      BYTE

It's BYTE, for now.

Leave a Reply

Your email address will not be published. Required fields are marked *