Logical Character Support in Character Columns

For new columns that you declare as built-in character data types, explicit or default size specifications are interpreted in units of bytes, unless the SQL_LOGICAL_CHAR configuration parameter has enabled logical character semantics for the current database. This feature is designed to reduce the risk of truncating data strings in locales that support a multibyte code set, such as UTF-8. Enabling this feature causes the SQL parser to interpret the declared column size as units of logical characters, rather than as bytes, and multiplies the declared storage size allocated for the new character column by a positive integer value, based on the SQL_LOGICAL_CHAR setting.
  • If the value of this setting is OFF or 1, the SQL_LOGICAL_CHAR configuration parameter has no effect.
  • If the value of this setting is ON, rather than a digit, the expansion factor is the number of bytes that are required to store the largest logical character in the code set of the database. (The ON setting is equivalent to 4, which is the largest valid digit.)

The value of this expansion factor is an attribute of the database, and is based on the SQL_LOGICAL_CHAR setting when the database was created, rather than when the ALTER TABLE statement is issued, if the two settings are not identical.

For columns that you declare as VARCHAR or NCHAR data types when this feature is enabled, only the maximum size specification is expanded by this feature. The reserved size is the number of bytes specified by the explicit or default reserved value in the data type declaration, because the minimum size of a logical character is 1 byte.

Size specifications for character columns of user-defined types (UDTs) are always interpreted as bytes, and are not affected by this feature. Columns that store strings as large objects, such as CLOB and TEXT, are similarly unaffected.

For more information about the SQL_LOGICAL_CHAR configuration parameter, see your HCL OneDB™ Administrator's Reference. For additional information about multibyte locales and logical characters, see the HCL OneDB GLS User's Guide.