Oracle is sorted by pinyin, radicals, strokes

Source: Internet
Author: User
The following method requires oracle9i and more versions to support it.
Before Oracle9i, Chinese is sorted according to binary encoding.
In oracle9i, according to pinyin, radical, stroke sorting function. Set Nls_sort value
Schinese_radical_m sorted by radical (first order), stroke (second order)
Schinese_stroke_m sorted by stroke (first order), radical (second order)
Schinese_pinyin_m Sort by Pinyin, the system's default sort method is phonetic sorting

Examples are as follows:
The table name is dept, where the Name field is Chinese, and the following is the order of strokes, radicals, and pinyin by company name.
1://Sort by stroke
2:select * FROM Dept ORDER by Nlssort (name, ' Nls_sort=schinese_stroke_m ');
3://Sort by radical
4:select * FROM Dept ORDER by Nlssort (name, ' Nls_sort=schinese_radical_m ');
5:// Sort by Pinyin, this is the default sorting method for the system
6:select * FROM Dept ORDER by Nlssort (name, ' Nls_sort=schinese_pinyin_m ');


Note that the SQL directive is not a standard instruction and is not implemented the same way below SQL Server.

To sort the names of the people who are queried according to the first letter of Pinyin

Select * from Ryjbqk where (XM -like '%¸ß% ' or xm-like '%´þ% ' or< /c6> xm like '%ºâ% ') and Ryid not in (select Ryid from rc_ Zsdj where czt= ' 1 ') ORDER by Nlssort (XM, ' Nls_sort=schinese_pinyin_m ')

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.