I’ve got some Oracle-Views which I’m using to generate multiple Letters.
For Example:
CREATE OR REPLACE VIEW V_blubb as
Select ID,
blubb
FROM THATSNOTINTERESTING;
and
CREATE OR REPLACE VIEW V_bla as
Select ID,
bla
FROM THATSNOTINTERESTING;
Now I have a function which gets some text input (HTML) and a html_id.
My function is going to decide which view it has to look at by the html_id it got and after this it should replace every tag <var name="COLUMNNAME"> </var> with a value in the DB. If it’s <var name"blallala"> </var> then there should be values of column ‘blallala’.
Now I’m able to choose the correct View and I would also be able (using dynamic SQL) to select JUST the value I want to insert. But I’m having a text where are multiple fields that should be replaced.
Example:
Intput: <var name="col1"> </var>, <var name="col2"> </var>
Output: VALUE_OF_ROW1_COL1, VALUE_OF_ROW2_COL2
VALUE_OF_ROW2_COL1, VLAUE_OF_ROW2_COL2
Problem:
I’m not able to fetch everything into a record because the view changes and the record can’t be initialised dynamically (i think). So I’m not able to query a dynamic select over a record I get using a cursor loop.
To be much more specific: I need a for loop or an idex to loop first over all rows and per row over every collumn…
I’ve found a solution for this. I generated in my function a new one as a string and executed this with the “EXECUTE IMMEDIATE function_string USING paramter” – function 🙂