Subject Re: Resultsets and stored procedures.
Author fabrice.aeschbacher@wanadoo.fr
Stephen,

Try:

SET TERM ; !!

CREATE PROCEDURE MY_RESULTSET()
RETURNS (
A NUMERIC ( 15, 2 )
, B VARCHAR ( 20 )
, PROGRESS INTEGER )
AS
BEGIN
PROGRESS = 0;
FOR SELECT
NUMERIC_VALUE, STRING_VALUE
FROM ANY_TABLE
INTO A, B /* Get columns from query */

DO BEGIN
PROGRESS = PROGRESS + A; /* Calculated column */
SUSPEND;
END;
END !!

This should "return" a "recordset" with 3 columns named A, B and
PROGRESS. Not tested but should work.
Every SUSPEND returns a row.

HTH,
Fabrice

--- In ib-support@y..., Stephen J. Thompson <stephen@t...> (by way of
Stephen J. Thompson <stephen@t...>) (by way of Stephen J. Thompson
<stephen@t...>) wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello all,
>
> I was wondering how I can return a result set from a stored
procedure?
>
> I need somthing like the following:
>
>
> CREATE PROCEDURE "retrieve_results" (UID INTEGER)
> AS
> RETURNS (results AS RESULTSET)
> BEGIN
> SELECT * FROM tbl_names WHERE uid = :uid;
> END;
>
>
> Any idea how I can do this?
>
>
> Thanks.
>
>
> Stephen.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.4 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE6cf+oPmm0AnNwb5MRAgu0AKCDXsFOY8WNQQgQy36RI5EWqpl/JgCePI0/
> YSBtMhmB3cvqssJswoaHKmg=
> =NUzY
> -----END PGP SIGNATURE-----