Linguistic Sorting


For the convenience of those using National Language Support, Oracle provides three different types of sorting: binary, monolingual, and multilingual. This section describes these different types of sorts. Different languages have different sort characteristics that are entirely unique to that language. Ñ will sort differently than N if sorted based on the Spanish language alphabet and if then sorted based on binary values of the represented characters. Providing the information to the user in the correctly sorted order will be important so that the results are in the order that they are expected.

Binary Sorting

Binary sorting, the conventional sorting mechanism, uses Oracle's default characteristics and sorts the values based on the binary values of the encoded characters (the letters). The alphabetic position of a character may differ somewhat from one language to another. This is the default sorting characteristic of the database unless something else is specified.

Monolingual Sorting

Monolingual sorting sorts the data in two passes. This sort algorithm is based on a character's assigned values (both the major value and the minor value). The first pass through the string is used to compute the major value for the entire string, and the second pass is used to compare the minor value for the entire string. Typically, letters with the same appearance will have the same major value but may have different minor values. Monolingual sorting provides better sorting than binary but still has its limitations. Oracle currently supports 68 monolingual sorts.

Multilingual Sorting

For multilingual sorting, Oracle provides a new sorting mechanism. Multilingual sorting is based on the new ISO 14651 standard and Unicode 3.0 standard for multilingual collation. This sorting mechanism allows each language to properly sort each and every encoded character. Currently, Oracle supports 13 different multilingual sorts.

NLS_SORT

The NLS_SORT environment variable specifies the type of sort to be used for character data. It is defined as a subtype of the NLS_LANG environment variable, so if the NLS_SORT is not applicable for the language set in the NLS_LANG variable, the NLS_LANG setting will take precedence. The settings for NLS_SORT can be altered at the session level.

NLSSORT

The NLSSORT function specifies the type of sort that should be performed for character data and allows sorts to be defined specifically at the query level. This allows for more fine-grained control of sorting behavior because the session's default can be allowed to be set at one setting, and each query can be run with a different setting if necessary.

The following section discusses language-dependent application behavior.



    Oracle 9i Fundamentals I Exam Cram 2
    Oracle 9i Fundamentals I Exam Cram 2
    ISBN: 0789732653
    EAN: 2147483647
    Year: 2004
    Pages: 244
    Authors: April Wells

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net