Subject Re: [IBDI] function TOP n FROM... was (Porting from...)
Author hannes hernler
Thank you Helen Borrie and Steve Tendon

-----Ursprüngliche Nachricht-----
Von: Helen Borrie <helebor@...>
>create procedure TOP_N(n integer, LastID integer)
>returning (sFirstName varchar(30), sLastName varchar(30), dBirthday date)
>...
>iCounter = 0;
>... iCounter = :iCounter + 1;
> if iCounter = :n then Exit;
>....

A stored procedure like this was in my mind too.
Steves hint to use a subquery compareing sorted
integers is also a sophisticated solution.

But what about performance?
How fast is a subquery compared with an iterative
loop in a stored procedure?
This was the idea behind my asking for TOP function
if it´s implemented in servers standard functions it could be faster?

hannes