Subject Re: [IBDI] Firebird 1 - Selecting a range of records from a result set (oops)
Author Kevin Lawrence
Sorry about the error (I didn't try to compile it) so let's try that
again....

> While the most generalized case isn't currently supported, it seems that
> this could be easily done for a specific case with a stored procedure:
>
> create procedure p_get_range(nStartPositionINTEGER, nEndPosition INTEGER)
> returns (<field_list>)
> as
> DECLARE VARIABLE nCount INTEGER;
> BEGIN
> nCount = 0;
>
> FOR SELECT <field_list>
> FROM <tablename(s)>
> ORDER BY <order by clause>
> INTO :<field_list>
> DO
> BEGIN
> nCount = nCount + 1;
> IF (nCount > nEndPosition) THEN
> EXIT;
> ELSE IF (nCount >= nStartPosition) THEN
> SUSPEND;
> END
> END
>
> Simply select from the procedure:
>
> SELECT * FROM p_get_range(10, 20)




Kevin