I need to create a function in Oracle that accepts a table name and return a collection the content of which is based the table that accepted.
I've been doing some search, many examples are of the form:
first, define a table type;
then, fill a table of that type and return it.
But I won't know the structure of the collection that need to be returned until the function is called, so I can not define a table type at the time of programming.
How can I make it?
Best Answer
I haven't syntax checked this but it should put you on the right path.
This should be put in a package but for demonstration purposes...
This should work on Oracle 9,10 and 11 and could be simplified for 12 by using RETURN_RESULT.