Subject Stored procedure
Author Datatal AB - Gauffin, Jonas
Hello

I want to create a stored procedure that checks a column after a gap (seatbooking, if seats 1,2,4 are booked it should return 3. If seats 1,2,3,4 is booked it should return 5)

my procedure complains on the INTO line.

CREATE PROCEDURE SP_FIND_SEAT (
FLIGHTNR CHAR(5),
AVG_DATUM CHAR(10))
RETURNS (
PLATSNR INTEGER)
AS
DECLARE VARIABLE LAST_PNR INTEGER;
begin
LAST_PNR = 0;
FOR
select platsnr
from bokning b
inner join bokning_passagerare bp on (b.bokningsnr=bp.bokningsnr)
where b.flight_nr = :avg_datum
AND b.avg_datum = :flightnr
order by platsnr
INTO :platsnr;
if last_pnr+1 <> :platsnr then /*found one, how do I exit the procedure*/
DO suspend;
:platsnr=:platsnr+1;
end


[Non-text portions of this message have been removed]