Page 1 of 1

Error for sort with '

Posted: Thu 16 Aug 2012 06:35
by sinys
OraQuery1.SQL.text := 'select ''1'' from dual'; // Field as string
OraQuery1.Open;
OraQuery1.IndexFieldNames := '''1'' DESC;'; // raise error Field 1 not found

Re: Error for sort with '

Posted: Thu 16 Aug 2012 08:01
by AlexP
hello,

In the provided query '1' is not the name but the field value, therefore when attempting to set IndexFieldNames, you get an error.
To use IndexFieldNames with such queries, you should use alias, i.e.:

Code: Select all

OraQuery1.SQL.text := 'select ''1'' as MyField from dual'; 
OraQuery1.Open;
OraQuery1.IndexFieldNames := 'MyField DESC;'; 
P.S. In Oracle fields can start with a letter only

Re: Error for sort with '

Posted: Thu 16 Aug 2012 08:13
by sinys
Can I get around it somehow indicating the serial number for sorting for example? (like sql "order by 1", but for local sorting)

Re: Error for sort with '

Posted: Thu 16 Aug 2012 09:15
by AlexP
hello,

At the moment, you cannot use field numbers in local sorting, we will review the possibility to add this feature in one of the next versions