|
I honestly am not sure what you're looking for eactly in your query
but you asked if you can have dynamic XMLElement generation.
By that, I'm assuming you mean dynamic tags in the output. If so,
then yes it is possible. Here is an example using the SCOTT sample
user.
SELECT
CASE table_name
WHEN 'EMP' THEN
xmlelement("PrivateInfo", table_name || '')
WHEN 'BONUS' THEN
xmlelement("PrivateInfo", table_name )
ELSE
xmlelement("PublicInfo", table_name )
END xml_frag
FROM USER_TABLES
ORDER BY table_name
/
XML_FRAG
---------------------------------------------
<PrivateInfo>BONUS</PrivateInfo>
<PublicInfo>DEPT</PublicInfo>
<PrivateInfo>EMP</PrivateInfo>
<PublicInfo>EMP_AUD</PublicInfo>
<PublicInfo>ORDERS</PublicInfo>
<PublicInfo>PRODUCT_GROUPS</PublicInfo>
<PublicInfo>SALGRADE</PublicInfo>
7 rows selected.
I'm not sure where this feature would be useful, and it seems a little
buggy to me. Notice the ||''. I'm researching that. I'm not sure
if it's an artifact of the CASE or the XMLElement or a combination.
Fascinating. (I'm making Spock eyebrows right now).
By the way, I'm running 10g, not 9i.
|