Re:Oracle,Substr function in OrderBy
On Thu, 10 Dec 1998 15:25:43 -0500, Bill Schwenzfeier <schwe...@rl.af.mil>
wrote:
Quote
> I want to use Delphi 3 with Oracle and use the Substring function in
>an Order By clause. When I do, I get an 'invalid use of keyword token'
>error when the application attempts to show the screen.
Some database systems do not allow you to base the ORDER BY clause directly
on expressions, only on columns. Since you are using Oracle and this would
be pass-through SQL, I would advise looking at the vendor supplied
documentation on Oracle to see what the actual limitations are and how you
can work around them.
In local SQL (you did post to the newsgroup for desktop databases <grin>),
this can be handled by having the expression in the SELECT clause and
referring to that column in the ORDER BY clause using a number. This number
is the ordinal position of the expression column in the SELECT clause. For
example:
SELECT SUBSTRING(C.Company FROM 1 FOR 1), C.*
FROM Customer C
ORDER BY 1
//////////////////////////////////////////////////////////////////////////
Steve Koterski "What is success in this world? I would say
Technical Publications it consists of four simple things: to live
INPRISE Corporation a lot, to love a lot, to laugh a lot, and
http://www.inprise.com/delphi from it all, to learn a lot."
-- Richard J. Needham