How to output result of "execute immediate" ?
Hello folk;
I only have one question how to outuput the result of the execute immediate?
My plsql code :
[code]
set serveroutput on size unlimited;
declare
n table.numrum%type;
sqlqry clob;
cols clob;
res clob;
begin
select d.numrum, listagg('''' || d.diag || ''' AS DIAG' || rownum, ',') WITHIN GROUP (ORDER BY d.numrum) into n, cols
from ...
WHERE ...
group by ...;
sqlqry:='select * from
(select d.*
from ....
WHERE ...)
pivot
(
MIN(diag) for diag in (' || cols || ')
)';
dbms_output.put_line('sqlqry =>*'||sqlqry||'*');
execute immediate sqlqry;
end;
/
[/code]
Thanks for your help . Regards