ORACLE中文欄位排序

來源:互聯網
上載者:User

做一個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:
r> -----------------------------------------------------------
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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.