日期:2014-05-16 浏览次数:20596 次
Oracle9i之前,中文是按照二进制编码进行排序的。在oracle9i中新增了按照拼音、部首、笔画排序功能。 1、设置NLS_SORT参数值 2、Session级别的设置,修改ORACLE字段的默认排序方式: 3、语句级别设置排序方式: 4、修改系统参数(数据库所在操作系统): ?????? export NLS_SORT (sh) ? ? Oracle 官方说明
NLS_SORT NLS_SORT specifies the collating sequence for ORDER BY queries. NLS_COMP NLS_COMP specifies the collation behavior of the database session.
Property Description Parameter type String Syntax NLS_SORT = { BINARY | linguistic_definition } Default value Derived from NLS_LANGUAGE Modifiable ALTER SESSION Range of values BINARY or any valid linguistic definition name
????? SCHINESE_RADICAL_M 按照部首(第一顺序)、笔划(第二顺序)排序
????? SCHINESE_STROKE_M 按照笔划(第一顺序)、部首(第二顺序)排序
????? SCHINESE_PINYIN_M 按照拼音排序
????? 按拼音:alter session set nls_sort = SCHINESE_PINYIN_M;
????? 按笔画:alter session set nls_sort = SCHINESE_STROKE_M;
????? 按偏旁:alter session set nls_sort = NLS_SORT=SCHINESE_RADICAL_M;
????? 按照笔划排序
????? select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_STROKE_M');
????? 按照部首排序
????? select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_RADICAL_M');
????? 按照拼音排序,此为系统的默认排序方式
????? select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_PINYIN_M');
????? set NLS_SORT=SCHINESE_RADICAL_M ;
?????? setenv NLS_SORT SCHINESE_RADICAL_M (csh)
????? HKLC\SOFTWARE\ORACLE\home0\NLS_SORT (win注册表)
?
If