Before Oracle9i, Chinese characters were sorted by binary encoding.
The sorting by pinyin, radical, and stroke function is added to Oracle9i. Set the nls_sort Value
Schinese_radical_m is sorted by the beginning (first order) and strokes (Second Order ).
Schinese_stroke_m is sorted by strokes (first order) and heads (Second Order ).
Schinese_pinyin_m is sorted by pinyin. The default sorting method is pinyin.
Example:
The table name is Dept, where the name field is Chinese. The following lists the strokes, radicals, and Pinyin of the unit names.
1: // sort by strokes
2: Select * from Dept order by nlssort (name, 'nls _ sort = schinese_stroke_m ');
3: // sort by department heads
4: Select * from Dept order by nlssort (name, 'nls _ sort = schinese_radical_m ');
5: // sort by pinyin. This is the default sorting method of the system.
6: Select * from Dept order by nlssort (name, 'nls _ sort = schinese_pinyin_m ');
Note that this SQL command is not a standard command and is implemented in different ways in sqlserver.
Sort the queried personnel names by the first letter of the pinyin alphabet.
Select * From ryjbqk where (XM like '% ?? % 'Or XM like' %'t %' or XM like '% O? % ') And ryid not in (select ryid from rc_zsdj where CZT = '1') order by nlssort (XM, 'nls _ sort = schinese_pinyin_m ')