id parent_id Name Text
0 ........... body_text
1 ..........0 text....... . something
2 ..........0 blank
3 ..........2 text ........ something
4 ........... info
5 ..........4 text ........ something
Who knows how to get the following xml format from the previous hierarchical table:
<?xml version "................."?>
<body_text>
<text>something</text>
<blank>
<text>something</text>
</blank>
</body_text>
<info>
<text>some</text>
</info>
The only know how to do part of this is and now that isn’t working either:
select DBMS_XMLGEN.getXML(DBMS_XMLGEN.newcontextfromhierarchy('SELECT level,
XMLElement(evalname(Name), text))
from my_table t
START WITH id_parent is null
CONNECT BY PRIOR id = parent_id'))
FROM dual
The query you have provided will give you result you are expecting. You just have a couple of syntactical errors. First.
parent_idandid_parentcolumn names have a different position ofidin your query. Make them the same. Second. remove last parenthesis)fromXMLElement(evalname(Name), text))