Subject Re: SELECT FIRST
Author Nico Callewaert
Ok Helen, thanks !

Best regards, Nico

--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 01:19 PM 26/04/2004 +0000, you wrote:
> >Hi,
> >
> >How could I convert a 'SELECT FIRST....' statement back to IB 5.6
> >? Problem is the queries have to remain compatible with IB 5.6,
so I may
> >not use a SELECT FIRST.
>
> You have to do what we used to do before we had SELECT FIRST -
create a
> selectable SP:
>
> create procedure getfirst(inparam1 sometype, inparam2..., retrows
int,
> skiprows int)
> returns ( pkvalue int, outparam1 sometype, outparam2...)
> as
> begin
> for select pkvalue, blah...from..
> where...
> order by ...
> into :pkvalue, :outparam1, :outparam2...
> do begin
> if (retrows = 0 or pkvalue is null) then
> exit;
> skiprows = skiprows - 1;
> if (skiprows < 1) then
> begin
> suspend;
> retrows = retrows -1;
> end
> end
> end
>
> /hb