Subject Re: Newbie : Stored procedure to return multiple rows
Author NextStepSolutions
Thanks guys :)

I downloaded the UserGroupsDB.sql file from the Yahoo Groups 'files'
section which also helped.
Now I have :

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 BEGIN
SUSPEND;
END
END !!
SET TERM ;!!


This is recognised as a valid stored procedure by iSql, but only
returns one row.
I was hoping to get all rows from the table - is it SUSPEND that is
causing it to stop after just one row?

Andy











--- In firebird-support@yahoogroups.com, "Pierre Y." <pierre@c...> wrote:
> 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.