Before Oracle9i, Chinese characters were sorted by binary encoding. The sorting by pinyin, radical, and stroke function is added to oracle9i.
1. Set the NLS_SORT parameter value
SCHINESE_RADICAL_M is sorted by Ministry (First Order), strokes (Second Order), SCHINESE_STROKE_M by strokes (First Order), and ministry (Second Order) by SCHINESE_PINYIN_M by pinyin
2. Set the Session level to modify the default sorting method of ORACLE fields:
Pinyin: alter session set nls_sort = SCHINESE_PINYIN_M;
Stroke: alter session set nls_sort = SCHINESE_STROKE_M;
By Bias: alter session set nls_sort = NLS_SORT = SCHINESE_RADICAL_M;
3. Set the sorting method at the statement level:
SORT by strokes select * from dept order by nlssort (name, 'nls _ SORT = SCHINESE_STROKE_M ');
SORT by department heads select * from dept order by nlssort (name, 'nls _ SORT = SCHINESE_RADICAL_M ');
Sort by pinyin. This is the default sorting method of the system.
Select * from dept order by nlssort (name, 'nls _ SORT = SCHINESE_PINYIN_M ');
4. Modify system parameters (the operating system of the database ):
Set NLS_SORT = SCHINESE_RADICAL_M export NLS_SORT (sh) setenv NLS_SORT SCHINESE_RADICAL_M (csh) HKLC \ SOFTWARE \ ORACLE \ home0 \ NLS_SORT (win Registry)