Я исправил ваши "в" ссылки и типы данных, чтобы получить это
SQL> DECLARE
2 l_xmltype clob;
3
4 BEGIN
5 select dbms_xmlgen.getxml('SELECT SUBSTR(e.value,1,25) "curundo",
6 ROUND(d.undo_size / (to_number(f.value) * g.undo_block_per_sec)) "recundo"
7 FROM (
8 SELECT SUM(a.bytes) undo_size
9 FROM v$datafile a,
10 v$tablespace b,
11 dba_tablespaces c
12 WHERE c.contents = ''UNDO''
13 AND c.status = ''ONLINE''
14 AND b.name = c.tablespace_name
15 AND a.ts# = b.ts#
16 ) d,
17 v$parameter e,
18 v$parameter f,
19 (
20 SELECT MAX(undoblks/((end_time-begin_time)*3600*24))
21 undo_block_per_sec
22 FROM v$undostat
23 ) g
24 WHERE e.name = ''undo_retention''
25 AND f.name = ''db_block_size''')
26 into l_xmltype from dual;
27
28 END;
29 /
PL/SQL procedure successfully completed.
Конечно, просто поместите вывод в переменную. Если вы хотите это на экране, вы можете просто сделать выбор без PLSQL, например,
SQL> spool myfile.out
SQL> select dbms_xmlgen.getxml('SELECT SUBSTR(e.value,1,25) "curundo",
2 ROUND(d.undo_size / (to_number(f.value) * g.undo_block_per_sec)) "recundo"
3 FROM (
4 SELECT SUM(a.bytes) undo_size
5 FROM v$datafile a,
6 v$tablespace b,
7 dba_tablespaces c
8 WHERE c.contents = ''UNDO''
9 AND c.status = ''ONLINE''
10 AND b.name = c.tablespace_name
11 AND a.ts# = b.ts#
12 ) d,
13 v$parameter e,
14 v$parameter f,
15 (
16 SELECT MAX(undoblks/((end_time-begin_time)*3600*24))
17 undo_block_per_sec
18 FROM v$undostat
19 ) g
20 WHERE e.name = ''undo_retention''
21 AND f.name = ''db_block_size''')
22 from dual;
DBMS_XMLGEN.GETXML('SELECTSUBSTR(E.VALUE,1,25)"CURUNDO",ROUND(D.UNDO_SIZE/(TO_NU
--------------------------------------------------------------------------------
<?xml version="1.0"?>
<ROWSET>
<ROW>
<curundo>900</curundo>
<recundo>41668</recundo>
</ROW>
</ROWSET>