In analyticdb 5.2, if you use SQL to create a table and set the field attribute to ccsid 65535, you can perform fuzzy queries in Chinese. However, if you use DDS to create a table, use field level keyword to set the field attribute to ccsid.
(65535), then the Chinese fuzzy query cannot be used, because 0e/0f control code is also used as a common character.
For example
R Test
-Name -- A (20) -- ccsid (65535)
Create a PF file qgpl/test
Insert into qgpl/test values ('People's Republic of China ')
Fuzzy query using query
Select * From qgpl/test where name like '%'
The system returns zero rows of records.
To perform fuzzy query on the 65535 field, you must modify the query syntax:
Select * From qgpl/test where hex (name) Like SUBST (hex ('中'), 1, 3) | '%'
The returned result is
-------- People's Republic of China
The returned result is correct.
The processing process of Simplified Chinese in a single-byte environment is fully considered, that is, a dual-byte character (with 0e/0f Control Code) is treated as four bytes, the data contained in these bytes cannot be correctly parsed in a single-byte environment. Therefore, the hexadecimal format must be used for processing.
If you want to search for "Zhonghua", the search conditions must be written as follows:
Select * From qgpl/test where hex (name) Like SUBST (hex ('中'),) | '%'
Because 0e/0f only appears at the beginning and end of a double-byte string, the number of characters to be retrieved for two Chinese characters is 5.