Nonstop Database, HiRDB Version 9 Description

[Contents][Glossary][Index][Back][Next]

7.6 Space conversion facility

In a data comparison, one double-byte space character and two single-byte space characters will be recognized as different data. Therefore, table data containing a mixture of double-byte and single-byte space characters can produce incorrect retrieval results.

Example
The following data are recognized as being different:
[Figure]

The space conversion facility enables double-byte space characters and single-byte space characters to be intermixed in table data.

The double-byte space character being discussed here is coded as shown as follows. Two single-byte space characters are coded as X'2020'.

#: NCHAR and NVARCHAR cannot be used if the character encoding is Unicode (UTF-8), Unicode (IVS-supported UTF-8), or Chinese Kanji Code (GB18030).
Organization of this section
(1) Space conversion levels
(2) Setting the space conversion level

(1) Space conversion levels

As shown in the following table, three levels of space character conversion are provided by the space conversion facility.

Table 7-6 Space conversion levels

Level Explanation
Level 0 No space conversion.
Level 1 Converts as follows data spaces that occur in literals, embedded variables, and ? parameters in the data manipulation SQL or data spaces that are stored by utilities:
  • When a character string literal is being handled as a national character string literal, two single-byte space characters in succession are converted into one double-byte space character; in the case of a single occurrence of a single-byte space, no conversion is performed.
  • When a character string literal is being handled as a mixed character string literal, one double-byte space character is converted into two single-byte space characters.
  • During storage of data in a national character string-type column or during comparison of data with a national character string-type value expression, two single-byte space characters in succession in an embedded variable or ? parameter are converted into one double-byte space character; in the case of a single occurrence of a single-byte space, no conversion is performed.
  • During storage of data in a mixed character string-type column or during comparison of data with a mixed character string-type value expression, one double-byte space character is converted into two single-byte space characters.
Level 3 Adds the following processing to the processing of space conversion level 1:
  • During retrieval of data in a national character string-type value expression, one double-byte space character is converted into two single-byte space characters.

The following figures illustrate Level 1 and Level 3 processing.

Figure 7-20 Level 1 processing

[Figure]

Figure 7-21 Level 3 processing

[Figure]

(2) Setting the space conversion level

The desired space conversion level can be specified in the following operands:

For details about using the space conversion facility, see the HiRDB Version 9 System Operation Guide.