Re: PLSQL Execute Immediate
Date: Thu, 18 May 2006 18:30:13 +0200
Message-ID: <446ca115$0$10197$636a55ce_at_news.free.fr>
"CollyMitch" <colmjmitchell_at_gmail.com> a écrit dans le message de news: 1147969297.513307.264320_at_j73g2000cwa.googlegroups.com...
| Hi,
|
| 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.
|
You have to use dbms_sql package.
Regards
Michel Cadot
Received on Thu May 18 2006 - 18:30:13 CEST