Appending a string after XMLELEMENT in Oracle

Viewed 18

I have an query from which i am generating XML as output. I want to append a custom tag or some text after each element. I am not sure how to add in the query. The custom text is not going to be any xml tag.

Example:

<TEST ID="1" NAME="HELLO"></TEST><TEXT><TEST ID="2" NAME="HELLO2"></TEST><TEXT>

In the above scenario, I need to append text tag after each element. Please note that the text tag will not have a closing tag nor it is a self closing tag. Any ideas how to make that happen. Below is a sample of the query where i need to append the text after each element.

SELECT XMLAGG(XMLELEMENT("TEST", XMLATTRIBUTES('1' AS "ID",'HELLO' AS "NAME"))) AS RESULT FROM DUAL;
0 Answers
Related