I'm using a TDBGrid connected to a TDataSource. This TDataSource uses a TADOQuery as its dataset. The TADOQuery connects to a Oracle10g database and holds the following query:
SELECT ST.desc
FROM my.subsection ST
WHERE ST.date_disp = :dated
ORDER BY ST.desc
ST.desc is a string, and generally contains data like these:
'1st place'
'2nd place'
'A zone'
'Her zone'
'My zone'
'Zone'
Everything works perfectly, except that when I run the query in SQLTools, it returns the data sorted by LETTERS first, then NUMBERS. e.g.:
'A zone'
'Her zone'
'My zone'
'Zone'
'1st place'
'2nd place'
But when I run the application, the result is NUMBERS first, and then LETTERS! e.g:
'1st place'
'2nd place'
'A zone'
'Her zone'
'My zone'
'Zone'
I figured out that Oracle uses one sorting linguistic (http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch5lingsort.htm) and some Delphi component (TDBGrid or TDataSource?) another.
I then tried to make the result of the query fit Delphi's component order, which is NUMBERS then LETTERS. But this is not desired since the natural order for the users is LETTERS, then NUMBERS.
Does anyone know how I can be sure of which component is "re-sorting" the data and how can I make both sort orders the same?
NLS_SORT
or at leastNLS_LANGUAGE
set to a different codification than the language codification of the computer where you are doing the tests. I would start by unlink theTdatasource
of the query component and check in which order the elements are returned. – Guillem VicensTDbGrid
does no sorting on its own. It is just used to show the data. The sorting (if done) is usually done by the query component instead. – Guillem Vicens