Defining Variables with Logical Character Semantics

When the SQL_LOGICAL_CHAR configuration parameter has specified for the current session) is set to 'ON' or to a value greater than 1, HCL OneDB™ interprets size declarations as logical characters, rather than as bytes, in declarations of SPL variables of the following data types:
  • CHAR or CHARACTER
  • CHARACTER VARYING or VARCHAR
  • LVARCHAR
  • NCHAR
  • NVARCHAR
  • DISTINCT types whose base types are built-in character data types
  • DISTINCT types whose base types are the previously listed data types
  • ROW data type fields of any of the previously listed data types.
  • Elements of these data types in LIST, MULTISET, or SET collection data types.

Enabling logical character semantics for the database locale guarantees that sufficient storage is available for the data type to store the specified number of logical characters. The resulting size in bytes of the SPL variable is the product of the declared size of the data type multiplied by the SQL_LOGICAL_CHAR value, if this is 2, 3, or 4, or (if SQL_LOGICAL_CHAR is set to 'ON') by the number of bytes of storage that the largest logical character in the code set of the database locale requires.

If a client session connects to a database in which the SQL_LOGICAL_CHAR configuration parameter was enabled at the time of database creation, that setting takes effect at connection time.

DEFINE statements that use the LIKE keyword in datatype declarations create SPL variables whose data types match the schema of the column that the LIKE specification references. The SQL_LOGICAL_CHAR setting, if any is defined, has no effect on the size in memory of variables that DEFINE declares with the LIKE keyword.

For more information about the effect of the SQL_LOGICAL_CHAR setting in locales that use a multibyte code set, such as UTF-8, where a single logical character can require more than one byte of storage, see the description of the SQL_LOGICAL_CHAR configuration parameter in your HCL OneDB Administrator's Reference. For additional information about multibyte locales and logical characters, see the HCL OneDB GLS User's Guide.