Hi Jure,
Oracle can sort in several ways. By default Oracle will sort strings (VARCHAR) in a binary way, ie: strings will be sorted by the numeric values of each character in the database character set.
SQL> select * from nls_session_parameters where parameter like '%SORT%';
PARAMETER VALUE
---------- ----------
NLS_SORT BINARY
SQL> SELECT rownum, chr(ROWNUM) FROM dual CONNECT BY LEVEL <= 127 ORDER BY 2;
ROWNUM CHR(ROWNUM)
---------- -----------
[...]
48 0
49 1
50 2
51 3
[...]
65 A
66 B
67 C
68 D
[...]
97 a
98 b
99 c
You can alter the sorting behaviour:
SQL> alter session set nls_sort=french;
Session altered
SQL> SELECT rownum, chr(ROWNUM) FROM dual CONNECT BY LEVEL <= 127 ORDER BY 2;
ROWNUM CHR(ROWNUM)
---------- -----------
[...]
65 A
97 a
66 B
98 b
[...]
90 Z
122 z
48 0
49 1
50 2
[...]