Subject Re: Optimizing a query
Author Myles Wakeham
> On 28-Nov-2006 12:20:13, firebird-support@yahoogroups.com wrote:
> > > SELECT FIRST 20 SKIP 0 * from ASSET_LIST_GET_PRC();
>
> Instead of doing the FIRST 20 here, I suggest you do that in your
> Stored Procedure, that should be faster. Let me know the results.

Well I took all of your advice here (much appreciated) and have the
procedure running like a rocket now. But I'm trying to work out how to move
the 'paging' to the stored procedure, so that I can do the SELECT FIRST X
SKIP Y logic in the stored procedure.

I want to be able to pass in these values as arguments to the stored proc,
but I can't seem to get them working by referencing the input parameters in
the query in the SP like so:

SELECT FIRST :A_ROW_COUNT SKIP :A_POSITION .....

Where :A_ROW_COUNT and :A_POSITION are parameters being passed in.

What's the secret here for this?

Regards,
Myles

===============================
Myles Wakeham
Director of Engineering
Tech Solutions US, Inc.
Phone (480) 451-7440
www.techsol.org