Is there a way to perform a Cursor For Loop with an dynamic SQL-statement?
If I don't want to declare a record I can do something like this (only if I declared the cursor..):
For I in cuSelect Loop
dbms_output.put_line(I.NAME);
End Loop;
And I can open a cursor for a dynamic SQL-statement:
Open cuSelect For 'Select * From TAB_X';
Fetch ceSelect Into recSelect;
Close cuSelect;
But to do that I have to first declare the Record.
Now my problem is that I have to open the Cursor for a very big and complicated dynamic SQL-statement. The structure of the record is unknown. Is there a way to open a variable cursor and iterate through it with an "undeclared" record?
I think you can do what you want with DBMS_SQL package.
You can also check these:
For example: