PLSQL Execute Immediate
Date: 18 May 2006 09:21:37 -0700
Message-ID: <1147969297.513307.264320_at_j73g2000cwa.googlegroups.com>
Hi,
[Quoted] I am writing a PLSQL function to read a DYNAMIC list of required fields and then use this list to pull the required data from a table.
eg.:
getFieldsList(param1,returnedList);
execute immediate 'select '|| returnedList || ' from emp' into ???;
obviously I need to put this INTO something but I'm not sure what as the list is dynamic. If I knew there were three columns then I could put them into 3 variables. What do I do when I don't know how many there are - i.e. determined at runtime?
I was thinking of creating a record - can I create a record of type emp%rowtype and use this? What will happen if there are only 2 cols but the row type has 5?
Would I need to parse the list (it's comma seperated) and find how many cols there are?
Thanks for the help,
Colm. Received on Thu May 18 2006 - 18:21:37 CEST