Thanks @ll J

 

Von: [email protected]
[mailto:[email protected]] Im Auftrag von Ann Harrison
Gesendet: Montag, 7. April 2014 17:30
An: [email protected]
Betreff: Re: [firebird-support] order by

 

  

On Mon, Apr 7, 2014 at 6:47 AM, checkmail <[email protected]> wrote:

 

 

I've a litte question. Now I can order by the column number, order by 1. Can
I set this information with a variable? 

Dim k as integer = 1;

Order by :k?

 

 

You can do the equivalent with an EXECUTE STATEMENT.    With the exception
of EXECUTE {STATEMENT | BLOCK}, Firebird optimizes a statement the first
time it is presented.  Query optimization includes choosing how and when to
sort the input.  Optimizing once and executing many times is more efficient
than using EXECUTE STATEMENT which treats each new iteration as a totally
new statement.

 

Good luck,

 

Ann

 

P.S.  I agree with the person who discourage the use of column numbers in
order by clauses.  Referencing fields by name rather than position was a
huge step forward when going from primitive to relational databases.  I hate
to see that abstraction eliminated to save typing.



Reply via email to