Subject Re: [firebird-support] SELECT FIRST [variable]
Author PenWin
I did it with EXECUTE STATEMENT for now, but I am not very happy about it -
I have my doubts about efficiency of such a solution (I suspect such queries
won't get the benefit of PREPARE).

Pepak

----- Original Message -----
From: "PenWin" <penwin@...>
To: <firebird-support@yahoogroups.com>
Sent: Tuesday, August 29, 2006 10:30 AM
Subject: [firebird-support] SELECT FIRST [variable]


> Hi!
>
> Is it possible to use a variable to limit a number of returned records?
> That
> is, I would like to create something like this:
>
> CREATE PROCEDURE something (maxrows INTEGER)
> RETURNS (key INTEGER, value INTEGER) AS
> BEGIN
> FOR SELECT FIRST :maxrows key, value FROM table INTO :key, :value DO
> SUSPEND;
> END
>
> Unfortunatelly, Firebird (1.5.2) is returning an error at :maxrows so I
> suspect it may require a literal after FIRST. But maybe I am doing
> something
> incorrectly?