Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Fetch record into a plsql table (record.column_1 into table(index_1))

Re: Fetch record into a plsql table (record.column_1 into table(index_1))

From: John Russell <netnews4_at_johnrussell.mailshell.com>
Date: Mon, 25 Nov 2002 02:34:46 GMT
Message-ID: <hf23uu82jdpusdj6f1p3008837un32fqf4@4ax.com>


On Sat, 23 Nov 2002 13:38:10 +0000 (UTC), "Alexander Miroshnikov" <alexander_miroshnikov_at_hotmail.com> wrote:
>These statements are executed using Native Dynamic SQL and every row in
>the result set is converted into a plsql table as follows -
>
>type columnlist is table of varchar2(4000)
>columns columnlist;
>...
>columns(1) := result.stringfield_1;
>columns(2) := result.stringfield_2;
>...
>columns(N) := result.stringfield_N;
>...
>
>What is the most efficient and elegant way of doing it, considering that
>the number of columns is not known beforehand?

If you at least know the maximum possible number of columns, maybe you could add a "BULK COLLECT INTO stringtable1 stringtable2 etc." clause inside the dynamic SQL. Then to get all the fields from row N of the result set, you'd reference stringtable1(N), stringtable2(N), and so on.

John Received on Sun Nov 24 2002 - 20:34:46 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US