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 PL/SQL block itself will come from the database as text. So I can’t edit that PL/SQL block. And it will return only two values whose column names will be same always. It will return list of 2 column combination values.
Here I am giving sample PL/SQL.
BEGIN
RETURN 'select distinct fundname d, fundname r from <table> where condition order by 1';
EXCEPTION
WHEN OTHERS THEN
RETURN 'SELECT ''Not Available'' d, ''Not Available'' r FROM dual';
END;
Any reply will be so helpful.
Here is a self contained example of how to “execute the anonymous PL/SQL and get the resultset object”
The above example query “select 1 id, ‘hello’ name from dual union select 2, ‘peter’ from dual;” can be replaced by any query.