Subject Re: [firebird-support] Re: Select first 3 and last 3 records
Author Norbert Nemeth
> Thanks MailMur however
> as far as I know the From Select statement will only be implemented in Ver 2
> so I am back to my original problem

Perhaps this way:

CREATE PROCEDURE PRC_XXXX (
PRNID CHAR(002))
RETURNS (
PRNID INTEGER,
INVNO INTEGER )
AS
BEGIN
/* First 3 records selection... */
FOR SELECT FIRST 3 PRNID
, INVNO
FROM ORDTRN
WHERE PRNID = :PRNID
ORDER BY INVNO ASC
INTO :PRNID,
:INVNO
DO
BEGIN
SUSPEND;
END

/* Last 3 records selection... */
FOR SELECT FIRST 3 PRNID
, INVNO
FROM ORDTRN
WHERE PRNID = :PRNID
ORDER BY INVNO DESC
INTO :PRNID,
:INVNO
DO
BEGIN
SUSPEND;
END
END

Regards,
Norbert