Hi Walter,

thanks a lot for your quick response, but it didn't help us. It's not the
problem with the (oracle) database, the ORDER BY-statement works fine. But
if you try to insert the 'SUBSTR(TEILE.TNR,4,3)' into the
'addAscendingOrderByColumn'-method or as you suggested the 'AsColumn'-method
the select-statement (through BasePeer) is not generated correctly. It seems
like a "real" column name is needed. We think there is an extension needed
in BasePeer's CreateQueryString-method which is able to execute such "free"
ORDER BYs (compare: criteria.Custom).

rgds,

Olli

-----Ursprungliche Nachricht-----
Von: Bartek Walter [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 10. Oktober 2001 15:03
An: Foth, Oliver
Betreff: Re: criteria.addAscendingOrderBy - Problem!


FO> Hi folks,

FO> we have a problem with inserting a special ORDER BY. We try to generate
the
FO> following SQL-statement (excerpt):

FO> ... ORDER BY SUBSTR(TEILE.TNR,4,3),TEILE.TNR

FO> Using   addAscendingOrderByColumn generates an error.
FO> Any ideas on generating the statement with criteria?

I am not sure, but many databases (Oracle?) will treat such query as an
error since 'order by' cols must be 'select-ed' first.
Try this way:

select (...), SUBSTR(TEILE.TNR,4,3) as some_expression
from some_table
order by some_expression;

This one probably is easier to express in Criteria language
(criteria.addAsColumn() or similar)

Bartek Walter



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to