PL/SQL (MOSC)

MOSC Banner

How to output result of "execute immediate" ?

edited Aug 12, 2019 11:45AM in PL/SQL (MOSC) 2 commentsAnswered ✓

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

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center