Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XMLElement dynamic name

532688Sep 8 2006 — edited Sep 13 2006
Hi,

I am developing a piece of SQL that needs to generate an XML document based of data in our tables.

Using the following sql
INSERT INTO kinlan
SELECT TO_CLOB
(XMLELEMENT
("Sub",
(SELECT XMLAGG
(XMLELEMENT ("Entity", xmlattributes (ned.ref_type AS "ref_type"),
XMLFOREST (p.first_name,
p.date_of_birth,
p.middle_names,
o.org_name
)
) ORDER BY ned.ref_type ASC
)
FROM entity e,
person p,
org o,
defn ned
WHERE e.ent_no = p.ent_no(+)
AND e.ent_no = o.ent_no(+)
AND ned.etd_no = e.etd_no
AND e.sub_no = s.sub_no
AND e.ent_no_parent IS NULL)
)
)
FROM sub s
WHERE s.sub_no = xyz

All appears well, however my problem is that I cannot change the name of the XML Element dynamically in the results.

I would like to replace the XMLELEMENT ("Entity", xmlattributes (ned.ref_type AS "ref_type"), with the following XMLELEMENT ( ned.ref_type .... which would make an element that reflects the value of the ref_type rather than having to have an <Entity ref_type="abc".....

Is their anyway to do this.

Kind Regards,
Paul
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 11 2006
Added on Sep 8 2006
5 comments
4,837 views