Linguistic sorting with Oracle

Share

Sorting characters is done differently from one language to another. For example, in English digits come before letters in an ascending sorting. But, in German, digits are ascendant sorted after letters. Sorting may or may not be case sensitive, diacritics may be considered or ignored, and phonetic rules could also be used (e.g.: in Spanish ch is a distinct character that comes after c, which means that the correct order is: cerveza, colorado, cheremoya). Oracle provides support for linguistic sorting.
Oracle provides support for language-based sorting. Three types of sorting methods are available:

  • Binary sort
  • Monolingual linguistic sort
  • Multilingual linguistic sort

Binary sort

This represents the fastest type of sorting. It uses the numeric value of characters, established by the encoding scheme, for example ASCII. However, a binary sorting is not linguistic. For example, character ă has a higher numeric values associated to it, than b has.

Linguistic sort

A linguistic sort works by replacing characters with numeric values, like binary sort does but, those numeric values reflect the proper linguistic order of characters.

When using monolingual linguistic sort, the characters are compared in two steps. Each character has two numeric values associated to it. One is the major value and the other is the minor value. both kinds of values are defined by Oracle. For diacritics for example, a diacritic has the same major value like its corresponding letter but, the minor values are different. The same rule applies to letter cases (e.g.: a and A).

Beyond monolingual sorting, Oracle also provides a more complex linguistic sort: multilingual linguistic sort. This sorting technique allows us to sort a set of data in more than one language. This is useful for multilingual databases. For further details please see References.

Here is a small example of how you can specify in what language do you want Oracle to sort the data:

1
SELECT * FROM test ORDER BY NLSSORT(name, 'NLS_SORT=german');

Alternatively, one can specify the sorting language for the entire session:

1
2
-- GBK stands for British English
ALTER SESSION SET NLS_SORT = GBK;

References

Oracle linguistic sorting

Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close