Notifications

22 views

Description

Overview

The character counter on multi-line text fields on Oracle databases is behaving differently than explained in the documentation: Text Field Character Counter

Character Counter when using an Oracle database

The "glide.ui.textarea.character_counter" System Property places a counter on string fields which is simply a display on the number of characters that the user has entered. This will will turn red when the max length is exceeded.

However, this is not always the case for the ServiceNow applications running on Oracle databases, because in Oracle databases you can declare columns/variables as varchar2(n CHAR) and varchar2(n BYTE).

n CHAR means the variable will hold n characters. In multi byte character sets, you don't always know how many bytes you want to store, but you do want to guarantee the storage of a certain amount of characters. In case of Unicode for example, one character may occupy up to 4 bytes.

n BYTE means simply the number of bytes you want to store.

If you don't specify either BYTE or CHAR then the default is taken from NLS_LENGTH_SEMANTICS session parameter.

However, varchar2(4000 CHAR) does not mean you are guaranteed to store up to 4000 characters. The limit is still 4000 bytes, so in worst case you may store only up to 1000 characters in such a field.

Additional Information

  • Oracle strongly recommends that you do NOT set the NLS_LENGTH_SEMANTICS parameter to CHAR in the instance or server parameter file. This may cause many existing installation scripts to unexpectedly create columns with character length semantics, resulting in run-time errors, including buffer overflows.

    https://docs.oracle.com/database/121/REFRN/GUID-221B0A5E-A17A-4CBC-8309-3A79508466F9.htm#REFRN10124

  • On hosted instances, we do not specify any specific value for the NLS_LENGTH_SEMANTICS parameter, allowing the database instance to use BYTE as default.

Article Information

Last Updated:2019-08-02 20:49:23
Published:2019-03-23