需求:有一个student表,查询数据时需要按照其中的name字段进行排序,直接order by name个别数据顺序不对,于是搜了一些方法,如下:
在oracle 9i之前,对中文的排序,是默认按2进制编码来进行排序的. 9i时增加了几种新的选择:
按中文拼音进行排序:
SELECT * FROM student ORDER BY NLSSORT(name,'NLS_SORT = SCHINESE_PINYIN_M');
按中文首部进行排序:
SELECT * FROM student ORDER BY NLSSORT(name,'NLS_SORT = SCHINESE_STROKE_M');
按中文笔画进行排序:
SELECT * FROM student ORDER BY NLSSORT(name,'NLS_SORT = SCHINESE_RADICAL_M');
转自:http://www.cnblogs.com/discuss/articles/1866953.html