Subject Re: [firebird-support] Re: problem using SELECT FIRST N in SP
Author Alan.Davies@aldis-systems.co.uk
Quoting constantijnw <cw.s@...>:

Yes - Exactly!!!!
Thanks very much; I tried various options as you could see, and was
resigned to
keeping the select statement issued from within Delphi, but your code did it.
I have posted the actual version with date checking, before adding a range of
other fields such as HCL, CO2 etc.. This is for an emissions monitoring
system.

CREATE PROCEDURE GET_TOP_TEN (
FROMDATE DATE,
UPTODATE DATE)
RETURNS (
NOX_HIGH NUMERIC(9,2),
NOX_DATE DATE,
NOX_TIME CHAR(8) CHARACTER SET NONE)
AS
DECLARE VARIABLE LOW_HIGH INTEGER;
begin
low_high=0;
for select
nox,date_in,time_in
from releases
where date_in>=:FromDate
and date_in<=:UptoDate
order by nox desc
into :nox_high,:nox_date,:nox_time
do
begin
suspend;
if (low_high=9) then
exit;
else
low_high=low_high+1;
end
end

--
Alan J Davies
Aldis
Tel: +44 (0)1926 842069
Mob: +44 (0)7885 372793