使用 Oracle 11,当我这样做时
SELECT XMLELEMENT("dummy", NULL) as xml_1
FROM dual
输出是<dummy></dummy>
我怎样才能强制返回 <dummy />
?
is this just for presentation purposes, as both are the same. Oracle's function just happen to return non short tag style.
xmltype constructor though will convert it on 11g (in 10g the extract function did too, but not in 11g).
SQL> SELECT xmltype(XMLELEMENT("dummy", NULL).getclobval()) as xml_1 from dual;
XML_1
--------------------------------------------------------------------------------
<dummy/>