Oracle is sorted by pinyin, radical, and strokes

Source: Internet
Author: User
The following method is supported by Oracle9i and later.
Before Oracle9i, Chinese characters were sorted by binary encoding.
The sorting by pinyin, radical, and stroke function is added to Oracle9i. Set the nls_sort Value
Schinese_radical_m is sorted by the beginning (first order) and strokes (Second Order ).
Schinese_stroke_m is sorted by strokes (first order) and heads (Second Order ).
Schinese_pinyin_m Sort by pinyin The default sorting method is pinyin sorting.

Example:
The table name is Dept, where the name field is Chinese. The following lists the strokes, radicals, and Pinyin of the unit names. 1: // Sort by strokes
2: Select * From dept order by nlssort ( Name , 'Nls _ sort = schinese_stroke_m' );
3: // Sort by department heads
4: Select * From dept order by nlssort ( Name , 'Nls _ sort = schinese_radical_m' );
5: //Sort by pinyin, Which is the default sorting method of the system.
6: Select * From dept order by nlssort ( Name , 'Nls _ sort = schinese_pinyin_m' );

Note that this SQL command is not a standard command and is implemented in different ways in sqlserver.

Sort the queried personnel names by the first letter of the pinyin alphabet.

Select *FromRyjbqkWhere(XMLike '% Dynamic Route %' OrXMLike '%' Percent %' OrXMLike '% ° Â %' )AndRyidNot In(SelectRyidFromRc_zsdjWhereCZT = '1' )Order ByNlssort (XM, 'Nls _ sort = schinese_pinyin_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.