Re: HOWTO: STORED PROCEDURE RETURNING MANY ROWS
From: Gunter Herrmann <notformail0106_at_earthlink.net>
Date: Mon, 20 Jun 2011 17:12:51 -0400
Message-ID: <4dffb7d7$0$7617$9b4e6d93_at_newsspool1.arcor-online.net>
Andreas Mosmann wrote:
> Code-Fragment is
> ResultTable:=T_REF_TABLE(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
> ResultTable(1).ID:=1;
>
> T_REF_TABLE has 9 Elements.
> I tried ResultTable.Extend but it did not work too.
Date: Mon, 20 Jun 2011 17:12:51 -0400
Message-ID: <4dffb7d7$0$7617$9b4e6d93_at_newsspool1.arcor-online.net>
Andreas Mosmann wrote:
> Code-Fragment is
> ResultTable:=T_REF_TABLE(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
> ResultTable(1).ID:=1;
>
> T_REF_TABLE has 9 Elements.
> I tried ResultTable.Extend but it did not work too.
Before you can extend a collection you have to create it (with the table type constructor).
> I develop software for years, I know that dynamic vars have to be
> initialized/constructed.
It looks like you want to create a large set of data, so use the pipelined version:
FUNCTION fun_something
RETURN some_table_type PIPELINED
IS
lrec_output some_row_type;
BEGIN
- some loop here
lrec_output_row := some_row_type(something, somethingelse, somethingmore); PIPE ROW (lrec_output_row); -- end of loop here RETURN; -- note that you return nothing!END; Received on Mon Jun 20 2011 - 16:12:51 CDT