TOraQuery Component ...

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
nacovolo

TOraQuery Component ...

Post by nacovolo » Thu 30 Jun 2005 17:21

Hi!!!
I use a TOraQuery component in my delphi 7 project, and I have a problem/doubt about order of data.

The SQL's of TOraQuery component is:

SELECT CLIENTE_FORNECEDOR.COD_CLIENTE_FORNEC
, CLIENTE_FORNECEDOR.COD_PESSOA
, PESSOA.NOME
FROM MENUGERAL.CLIENTE_FORNECEDOR
, MENUGERAL.PESSOA
WHERE CLIENTE_FORNECEDOR.COD_PESSOA = PESSOA.COD_PESSOA
ORDER BY PESSOA.NOME

Data of SQL are:
COD_CLIENTE_FORNEC COD_PESSOA NOME
26 168 WILSON
27 169 ANTONIO
24 154 NELSON
29 154 NELSON
22 154 NELSON
25 156 LÍGIA
23 156 LÍGIA
20 167 ÓLEOS

The result of my SQL is using ORDER BY clause:
COD_CLIENTE_FORNEC COD_PESSOA NOME
27 169 ANTONIO
25 156 LÍGIA
23 156 LÍGIA
24 154 NELSON
29 154 NELSON
22 154 NELSON
26 168 WILSON
20 167 ÓLEOS

But, I´d like to have in this order:
COD_CLIENTE_FORNEC COD_PESSOA NOME
27 169 ANTONIO
25 156 LÍGIA
23 156 LÍGIA
24 154 NELSON
29 154 NELSON
22 154 NELSON
20 167 ÓLEOS
26 168 WILSON

What´s could happening with the order of the two lasts registers?

It´s all for this moment, and I´ll be waiting for a help.

Thank´s in advice.

Sincerely,


Nelson Antonio da Cruz Covolo

nacovolo

Post by nacovolo » Thu 30 Jun 2005 18:00

I use ODAC 5.00.0.2

brekhof
Posts: 22
Joined: Tue 16 Nov 2004 21:59

Post by brekhof » Thu 30 Jun 2005 19:35

Use something like 'alter session set nls_sort=latin' to set the sort options for your program (once for each session).

I'm not sure wether or not the 'Latin' is the best option for your particular situation but it works for me (Dutch).

hth,
Martin

nacovolo
Posts: 1
Joined: Thu 30 Jun 2005 18:02

Post by nacovolo » Thu 30 Jun 2005 20:11

Hi brekhof ...
Thank´s for your tip ...
But I use "SQL Navigator" (Quest Software) to develp my sql´s ... and it´s bring-me the result of my SQL in the order that i wanna.

So, should I use "alter session set nls_sort=..." in my DB or in my TOraSession?

brekhof
Posts: 22
Joined: Tue 16 Nov 2004 21:59

Post by brekhof » Thu 30 Jun 2005 20:59

nacovolo wrote:
So, should I use "alter session set nls_sort=..." in my DB or in my TOraSession?
I always put it in a OraScript component and execute that scripts right after connecting with a TOraSession.

hth,
Martin

Post Reply