如何创建 XML
<person>
<item value="Emma"/>
<item value="John"/>
</person>
来自类似
Emma;John
的字符串,使用 Oracle SQL 或 PL/SQL?
with strings(s) as (
select 'Emma;John' from dual
)
select
xmlelement("person",
xmlelement("item", xmlattributes( substr(s, 1, instr(s, ';')-1) as "value")),
xmlelement("item", xmlattributes( substr(s, instr(s, ';')+1) as "value"))
)
from strings
;