加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

Oracle:如何显示DBMS_XMLDOM.DOMDocument以进行调试?

发布时间:2021-01-01 07:42:12 所属栏目:站长百科 来源:网络整理
导读:运行Oracle 10g,Sqldeveloper 1.5.5 我想在sqldeveloper的输出或功效窗口中以字符串情势查察DBMS_XMLDOM.DOMDocument的内容.可能其他一些调试这个对象的简朴要领…… 感谢,P 办理要领 DBMS_XMLDOM.WRITETOBUFFER Writes the contents of the node to a buffe

运行Oracle 10g,Sqldeveloper 1.5.5

我想在sqldeveloper的输出或功效窗口中以字符串情势查察DBMS_XMLDOM.DOMDocument的内容.可能其他一些调试这个对象的简朴要领……

感谢,P

办理要领

DBMS_XMLDOM.WRITETOBUFFER  Writes the contents of the node to a buffer.
DBMS_XMLDOM.WRITETOCLOB    Writes the contents of the node to a CLOB.
DBMS_XMLDOM.WRITETOFILE    Writes the contents of the node to a file.

我有PL / SQL代码,它行使DIRECTORY将它毗连到文件体系:

dbms_xmldom.writeToFile(dbms_xmldom.newDOMDocument( xmldoc),'DATAPUMPDIR/myfile.xml') ;

我行使dbms_xmldom.writetoclob建设了一个函数

create or replace function xml2clob (xmldoc XMLType) return CLOB is
     clobdoc CLOB := ' ';
   begin
     dbms_xmldom.writeToClob(dbms_xmldom.newDOMDocument( xmldoc),clobdoc) ;
     return clobdoc;
   end;
   /

查询:

SELECT xml2clob(Sys_Xmlagg(
         Xmlelement(Name "dummy",dummy
                   ),Xmlformat('dual')))
   FROM dual;

输出:

<?xml version="1.0"?>
<dual>
  <dummy>X</dummy>
</dual>

您可以实行行使这样的函数:

create or replace function dom2clob (domdoc  DBMS_XMLDOM.DOMDocument) return CLOB is
     clobdoc CLOB := ' ';
   begin
     dbms_xmldom.writeToClob(domdoc,clobdoc) ;
     return clobdoc;
   end;
   /

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读