Detailed description of oracle sorting methods

Source: Internet
Author: User

Before Oracle9i, Chinese characters were sorted by binary encoding. The sorting by pinyin, radical, and stroke function is added to oracle9i.
1. Set the NLS_SORT parameter value
SCHINESE_RADICAL_M is sorted by Ministry (First Order), strokes (Second Order), SCHINESE_STROKE_M by strokes (First Order), and ministry (Second Order) by SCHINESE_PINYIN_M by pinyin

2. Set the Session level to modify the default sorting method of ORACLE fields:
Pinyin: alter session set nls_sort = SCHINESE_PINYIN_M;
Stroke: alter session set nls_sort = SCHINESE_STROKE_M;
By Bias: alter session set nls_sort = NLS_SORT = SCHINESE_RADICAL_M;

3. Set the sorting method at the statement level:
SORT by strokes select * from dept order by nlssort (name, 'nls _ SORT = SCHINESE_STROKE_M ');
SORT by department heads select * from dept order by nlssort (name, 'nls _ SORT = SCHINESE_RADICAL_M ');
Sort by pinyin. This is the default sorting method of the system.
Select * from dept order by nlssort (name, 'nls _ SORT = SCHINESE_PINYIN_M ');

4. Modify system parameters (the operating system of the database ):
Set NLS_SORT = SCHINESE_RADICAL_M export NLS_SORT (sh) setenv NLS_SORT SCHINESE_RADICAL_M (csh) HKLC \ SOFTWARE \ ORACLE \ home0 \ NLS_SORT (win Registry)

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.