Oracle implements Chinese characters sorted by pinyin, strokes and radicals
Source: Internet
Author: User
Oracle to achieve Chinese characters according to Pinyin, strokes and radical sort of some relevant information, are not very clear, they also studied the next, finally understand, hope to help.
It should be explained that the following method requires oracle9i and above to support.
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 sorted by Pinyin
The Helloword code is as follows:
The table name is MT, where the MTMC field is in Chinese, and the following is the order of strokes, radicals, and pinyin by unit name.
1: Sort by stroke
SELECT * FROM Mt ORDER by Nlssort (MTMC, ' nls_sort=schinese_stroke_m ');
2: Sort by radical
SELECT * FROM Mt ORDER by Nlssort (MTMC, ' nls_sort=schinese_radical_m ');
3: In alphabetical order, this is the system's default sorting method
SELECT * FROM Mt ORDER by Nlssort (MTMC, ' nls_sort=schinese_pinyin_m ');
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.