The XML generated by using
XMLAgg(XMLElement('student', ...)...)
spits out everything onto one line. Given that I have a very large table, it reaches line length limit when spooling.
I’d like to have each <student>…</student> node on a separate line. This page suggests using XMLText(x’0A’) to insert new lines, but SQLPlus doesn’t seem to recognize it.
I’ve already tried :
set long 2000000000
set linesize 32767
set wrap on
set trimspool on
The usual trick in 10g was to add
.extract('/*')on the outer xml operation you were doing egbut that doesn’t work in 11g. for a cross version compatible one using an xsl transform see Generate XML file with Customized XML tags out of oracle database table.
10.2.0.4:
and 11.2.0.2/3:
in short, to do this version agnositc, you should use a XSL. if you’re only trying this for adhoc stuff, then
extractis shorter to type on 10g andxmlserializeis shorter on 11g.