I would like to execute the anonymous PL/SQL and need to get the resultset object. I got the code which can be done by using cursors inside the PL/SQL block.
But the
Try something like this (pseudo-code):
[create or replace] function get_dataset (p_query in varchar2) return sys_refcursor
as
l_returnvalue sys_refcursor;
begin
open l_returnvalue for p_query;
return l_returnvalue;
end get_dataset;
The REF CURSOR which is returned can be processed like a normal dataset.
And beware of SQL injection when you use an approach like this...