Subject | RE: [firebird-support] Newbie : Stored procedure to return multiple rows |
---|---|
Author | Pierre Y. |
Post date | 2004-03-01T13:10:20Z |
SET TERM !!;
CREATE PROCEDURE getnames
RETURNS (
title VARCHAR(10),
forename VARCHAR(30),
surname VARCHAR(30)
) AS
BEGIN
FOR SELECT title, forename, surname
FROM name
INTO :title, :forename, :surname
DO
SUSPEND;
END!!
SET TERM ;!!
You have to call SUSPEND to ask the engine to bind the current "variables"
values to the row of the result set. The procedure execution flow will
continue at the next client fetch.
CREATE PROCEDURE getnames
RETURNS (
title VARCHAR(10),
forename VARCHAR(30),
surname VARCHAR(30)
) AS
BEGIN
FOR SELECT title, forename, surname
FROM name
INTO :title, :forename, :surname
DO
SUSPEND;
END!!
SET TERM ;!!
You have to call SUSPEND to ask the engine to bind the current "variables"
values to the row of the result set. The procedure execution flow will
continue at the next client fetch.