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.

  • 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-03-25 11:30:06