简体   繁体   English

表结果到Oracle中的xml

[英]table results to xml in oracle

Experts, I want to send some results via email in the form of table, for which i need to convert the results into xml format. 专家,我想通过电子邮件以表格的形式发送一些结果,为此,我需要将结果转换为xml格式。 I want to store the results in a variable and attach to the xml body. 我想将结果存储在变量中并附加到xml正文中。 The xml result gives me in the form of rows and i am unable to capture the xml results in a single row and convert that into varchar2 so that i can attach the variable. xml结果以行的形式提供给我,我无法在单个行中捕获xml结果并将其转换为varchar2,以便我可以附加变量。 Need help... I am using Oracle Sql Developer 11g. 需要帮助...我正在使用Oracle Sql Developer 11g。

Below is the script i am using 以下是我正在使用的脚本

select (XMLElement("tr"
,XMLFOREST(d.tablespace_name as "td", 
 d.file_name as "td",   d.bytes/1024/1024 as "td", 
 h.CREATION_TIME as "td",
 d.blocks as "td")))
from dba_data_files d
inner join v$datafile_header h
on d.TABLESPACE_NAME = h.TABLESPACE_NAME
order by d.TABLESPACE_NAME;

If I understood the question correctly - please have a look at XMLAGG: http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions215.htm 如果我正确理解了该问题-请查看XMLAGG: http : //docs.oracle.com/cd/B19306_01/server.102/b14200/functions215.htm

This function allows creating one xml from multiple records. 此功能允许从多个记录创建一个xml。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM