Background information
Oracle supports the DBDBMS_XMLGEN package and its functions for manipulation of xml-type
data.
SQL> SELECT dbms_xmlgen.newcontext('select * from dbmgr.xmldemo') FROM dual;
DBMS_XMLGEN.NEWCONTEXT('SELECT*FROMDBMGR.XMLDEMO')
--------------------------------------------------
1
SQL> select dbms_xmlgen.getxml(1) from dual;
DBMS_XMLGEN.GETXML(1)
--------------------------------------------------------------------------------
<? xml version="1.0"? >
<ROWSET>
<ROW>
<A>10</A>
<B>first line</B>
</ROW>
<
Solutions
Although PolarDB O Edition does not support the DBMS_XMLGEN package and its functions,
PolarDB provides XML-related functions, such as xmlagg, xmlroot, xmlforest, xmlelement,
xmlconcat, and xmlcomment. You can use these functions to implement similar functions.
van=> SELECT xmlforest(a AS A, b AS B) from xmldemo;
xmlforest
----------------------------
<a>10</a><b>first line</b>
<a>20</a><b>line 2</b>
(2 rows)
For more information, see https://www.postgresql.org/docs/11/functions-xml.html.