2.2.43 Operands related to character encoding

212) pd_substr_length = 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
Specifies the maximum number of bytes to be used to represent a single character.
The recommended value and the range of values that can be specified vary depending on the character encoding that is set. The following table shows the relationship of specified character encodings, recommended values, and specifiable values.
Setup character encodingRecommended valueSpecifiable value
utf-843-6
utf-8_ivs83-10
Other (This operand is disabled.)----
Legend:
--: No value is applied because this operand is disabled.
This operand is enabled if utf-8 or utf-8_ivs is specified for the character encoding, and affects the result length of the scalar function SUBSTR.
For details about the SUBSTR scalar function, see the manual HiRDB Version 9 SQL Reference.
Specification guidelines
If you use only characters in the UCS-2 range (1 to 3 bytes), you can omit this operand.
To use characters in the UCS-4 range, specify the maximum number of bytes to be used to represent a single character. According to ISO/IEC Standard 10646, 1 to 4 bytes is assigned for one UTF-8 character; and 1 to 4, or 7, or 8 bytes is assigned for one IVS-supported UTF-8 character. We recommend that you specify this operand to the maximum number of bytes for each character encoding.
If the specified value is greater than the actual number of bytes used to represent a character, the result of the SUBSTR scalar function might become too long. For this reason, evaluate the value to be specified in this operand on the basis of the character encoding actually used.
Notes
  • According to ISO/IEC 10646, 1 to 4 bytes is assigned for one UTF-8 character; and 1 to 4, or 7, or 8 bytes is assigned for one IVS-supported UTF-8 character. Bytes at the 5- and 6-byte positions (5-, 6-, 9-, and 10-byte positions for IVS-supported UTF-8) are reserved for future standards. Although 1 to 6 bytes (1 to 10 bytes for IVS-supported UTF-8) can be used for each character in HiRDB, we do not take responsibility for problems that might arise in the future if you use a byte position, such as a 5- or 6-byte position (a 5-, 6-, 9-, or 10-byte position for IVS-supported UTF-8) to which no character is assigned.
  • In Unicode (UTF-8) supported by version 06-02, you can use a maximum of 3 bytes per character. Version 08-00 supports a maximum of six bytes. For the character encoding (utf-8_ivs) supported by version 09-50, a maximum of 10 bytes can be used to represent a character. Therefore, with some data, the number of bytes representing a single character might increase.
  • If all the following conditions are satisfied, you must re-create SQL objects in routines and re-define view tables:
    [Figure]The character encoding is set to utf-8 or utf-8_ivs.
    [Figure]A value other than 3 is to be specified in the new pd_substr_length operand; or, in an environment where the pd_substr_length operand has already been specified, routines and view tables are to be defined and the pd_substr_length operand value is to be changed.
    [Figure]A SUBSTR scalar function with a mixed character string type (MCHAR or MVARCHAR) specified as its argument is to be specified in routines and view definitions.
    You can specify the PDSUBSTRLEN operand in the client environment definition to control the connection, or you can specify the SUBSTR LENGTH SQL compile option to control a routine.
  • The tables below show the priority among the pd_substr_length operand and other operands when the character encoding is set to utf-8 or utf-8_ivs.
    When control is performed by routine
    Control timingpd_substr_length operandClient environment definition
    PDSUBSTRLEN
    SQL compile option
    SUBSTR LENGTH
    Remarks
    During definitionValid (2)InvalidValid (1)Default value
    pd_substr_length
    During call or function callInvalid
    (depends on the specification made during definition)
    Invalid
    (depends on the specification made during definition)
    --None
    Legend:
    ( ): Priority level is indicated within the parentheses
    --: Cannot be specified
    When control is performed by view table
    Control timingpd_substr_length operandClient environment definition
    PDSUBSTRLEN
    SQL compile option
    SUBSTR LENGTH
    Remarks
    During definitionValid (2)Valid (1)--Default value
    pd_substr_length
    During operationInvalid
    (depends on the specification made during definition)
    Invalid
    (depends on the specification made during definition)
    --None
    Legend:
    ( ): Priority level is indicated within the parentheses
    --: Cannot be specified