ORACLE中文字段排序
2007-11-22 10:21
453 查看
做一个2个数据库间数据比较工具时遇到ORACLE中汉字排序的问题。
使用一下SQL
select *
from T_0303003
order by stock_holder
进行选取数据时(stock_holder为存放中文的字段),结果发现两库返回的记录顺序不一致。琢磨之后应该为字符集问题,一个库字符集为系统默认字符集,另一个库为UTF-8字符集。查找资料后发现,对于中文字段的排序,应该使用以下方式:
-- 按拼音排序 (系统默认)
select *
from T_0303003
order by nlssort(stock_holder,'NLS_SORT=SCHINESE_PINYIN_M');
-- 按部首排序
select *
from T_0303003
order by nlssort(stock_holder,'NLS_SORT=SCHINESE_RADICAL_M');
-- 按笔画排序
select *
from T_0303003
order by nlssort(stock_holder,'NLS_SORT=SCHINESE_STROKE_M');
ORACL官方论坛讨论:
http://www.oracle-database.cn/oracle_database_It-english-database-0-251288.html
Have found a strange question recently, arrange in an order Chinese character order by in oracle, " crocodile's word has been ranked at the end to appear! Whether there is such a situation to know the greater part. Whether it is bug i
-----------------------------------------------------------
NLS _ SORT? ??
answer2:
1 perhaps this word is many sound words. 2 says and says according to what way you want to arrange in an order.
ans wer3:
-----------------------------------------------------------
arranges in an order according to the spelling, should need to set up NLS _ SORT. Have Still in test test finish tell and then you body.
answer4:
-----------------------------------------------------------
O In RACLE, arrange in an order question 1. //Arrange in an order 2 according to the stroke. select * from dept order by nlssort(name,NLS _ SORT =SCHINESE _ STROKE _ M); 3.//Press Take the radical and arrange in an order 4. select * from dept order by nlssort(name,NLS _ SORT =SCHINESE _ RADICAL _ M); 5.//Arrange in an order according to the spelling, this arranges in an order the side for systematic acquiescenc Formula 6. select * from dept order by nlssort(name,NLS _ SORT =SCHINESE _ PINYIN _ M); Can revise NLS _ SORT parameter
使用一下SQL
select *
from T_0303003
order by stock_holder
进行选取数据时(stock_holder为存放中文的字段),结果发现两库返回的记录顺序不一致。琢磨之后应该为字符集问题,一个库字符集为系统默认字符集,另一个库为UTF-8字符集。查找资料后发现,对于中文字段的排序,应该使用以下方式:
-- 按拼音排序 (系统默认)
select *
from T_0303003
order by nlssort(stock_holder,'NLS_SORT=SCHINESE_PINYIN_M');
-- 按部首排序
select *
from T_0303003
order by nlssort(stock_holder,'NLS_SORT=SCHINESE_RADICAL_M');
-- 按笔画排序
select *
from T_0303003
order by nlssort(stock_holder,'NLS_SORT=SCHINESE_STROKE_M');
ORACL官方论坛讨论:
http://www.oracle-database.cn/oracle_database_It-english-database-0-251288.html
Have found a strange question recently, arrange in an order Chinese character order by in oracle, " crocodile's word has been ranked at the end to appear! Whether there is such a situation to know the greater part. Whether it is bug i
-----------------------------------------------------------
NLS _ SORT? ??
answer2:
1 perhaps this word is many sound words. 2 says and says according to what way you want to arrange in an order.
ans wer3:
-----------------------------------------------------------
arranges in an order according to the spelling, should need to set up NLS _ SORT. Have Still in test test finish tell and then you body.
answer4:
-----------------------------------------------------------
O In RACLE, arrange in an order question 1. //Arrange in an order 2 according to the stroke. select * from dept order by nlssort(name,NLS _ SORT =SCHINESE _ STROKE _ M); 3.//Press Take the radical and arrange in an order 4. select * from dept order by nlssort(name,NLS _ SORT =SCHINESE _ RADICAL _ M); 5.//Arrange in an order according to the spelling, this arranges in an order the side for systematic acquiescenc Formula 6. select * from dept order by nlssort(name,NLS _ SORT =SCHINESE _ PINYIN _ M); Can revise NLS _ SORT parameter
相关文章推荐
- ORACLE中文排序及在table中指定位置增加字段本篇文章来源于:开发学院 http://edu.codepub.com 原文链接:http://edu.codepub.com/2009/0531/5086.php
- Oracle 中文字段进行排序的sql语句
- Oracle 如何对中文字段进行排序
- Oracle中文、数字混杂字段的排序
- Oracle 中文字段进行排序的sql语句
- oracle 中文字段按首字母拼音排序
- Oracle中中文、数字,英文混杂形式的字段进行排序的方法
- Oracle 如何对中文字段进行排序
- Oracle中按照中文字段排序
- 【转】oracle 针对中文字段进行排序
- oracle表字段为汉字,依据拼音排序
- Oracle中如何用SQL检测字段是否包括中文字符
- SQL那些事儿(五)--oracle字段分组排序
- Oracle,SQL多重排序--多字段排序
- ORACLE判别字段是否包含中文
- oracle多字段排序
- ORACLE判别字段是否包含中文
- Oracle中判断字段是否包含中文
- mysql 中文字段排序( 按拼音首字母排序) 的查询语句
- ORACLE中文排序方式 vs SQL Server 2005的中文排序问题