Oracle ORDER by Chinese sort

Source: Internet
Author: User

When ordering by using order BY, the following occurs:

The impression of Chinese sorting should be by default in alphabetical order, why "Xin" will be ranked in the "middle" of the back? Suppose the order by is not based on the ASCII code of the corresponding character, so the corresponding ASCII is listed as follows:

It is basically possible to conclude that the size of the ASCII is actually sorted, which explains why the numbers precede the letters and why the letters precede the Chinese characters. But why the Chinese characters by default is the illusion of sorting by pinyin, so check the code of the Chinese character rules, there is a reference to the following sentence:

"First-level Chinese characters, is the most commonly used Chinese characters, alphabetical order, a total of 3,755, two-level Chinese characters, belong to the second most commonly used Chinese characters, according to the order of the radicals in the sequence, a total of 3,008"

Know, if the sort of Chinese characters are the first level of Chinese characters, it is in alphabetical order, if it is related to two-level Chinese characters, it is not necessarily.

However, if you want Chinese characters to be sorted by pinyin order, you can do so by:

Follow the pinyin sequence

ORDER by Nlssort (NAME, ' nls_sort=schinese_pinyin_m ')

According to the radical order

ORDER by Nlssort (NAME, ' nls_sort=schinese_radical_m ')

by stroke order

ORDER by Nlssort (NAME, ' nls_sort=schinese_stroke_m ')

Related Article

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.