Subject | Re: [ib-support] Re: Resultsets and stored procedures. |
---|---|
Author | Helen Borrie |
Post date | 2001-02-08T22:36:03Z |
At 04:18 PM 08-02-01 +0000, you wrote:
This will, though.
CREATE PROCEDURE GET_RECORDSET (INPUTCOL INTEGER)
AS
BEGIN
FOR SELECT COLUMN1, COLUMN2, COLUMN3
FROM ATABLE
WHERE COLUMN1 = :INPUTCOL
INTO :OUTPUTCOL1, :OUTPUTCOL2, :OUTPUTCOL3
DO
BEGIN
... /* any stuff you want to do to the data in the variables */
SUSPEND;
END
END
To call such a procedure, your SQL is
SELECT OUTPUTCOL1, OUTPUTCOL2, OUTPUTCOL2
FROM GET_RECORDSET(<integer argument>)
HB
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Stephen,It won't work.
>
>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.
This will, though.
CREATE PROCEDURE GET_RECORDSET (INPUTCOL INTEGER)
AS
BEGIN
FOR SELECT COLUMN1, COLUMN2, COLUMN3
FROM ATABLE
WHERE COLUMN1 = :INPUTCOL
INTO :OUTPUTCOL1, :OUTPUTCOL2, :OUTPUTCOL3
DO
BEGIN
... /* any stuff you want to do to the data in the variables */
SUSPEND;
END
END
To call such a procedure, your SQL is
SELECT OUTPUTCOL1, OUTPUTCOL2, OUTPUTCOL2
FROM GET_RECORDSET(<integer argument>)
HB
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________