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;
输出:
X
您可以尝试使用这样的函数:
create or replace function dom2clob (domdoc DBMS_XMLDOM.DOMDocument) return CLOB is
clobdoc CLOB := ' ';
begin
dbms_xmldom.writeToClob(domdoc,clobdoc) ;
return clobdoc;
end;
/