Subject problem using SELECT FIRST N in SP
Author Alan.Davies@aldis-systems.co.uk
Hi All - can anyone help with this? I want to select the top n from a table
which works no problem using a select statement, but fails inside an SP

This works with a single value

CREATE PROCEDURE GET_top_ten_1
RETURNS
(
nox1 numeric (9,2)
)
AS
begin
for select
First 1 nox
from releases
order by nox desc
into :nox1
do
suspend;
end

This version fails the compile but works fine as a sql statement
This is the error message...
Dynamic SQL Error
SQL error code = -313
count of column list and variable list do not match

CREATE PROCEDURE GET_top_ten_2
RETURNS
(
nox1 numeric (9,2),
nox2 numeric (9,2)
)
AS
begin
for select
First 2 nox
from releases
order by nox desc
into :nox1,:nox2
do
suspend;
end


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