Skip to Main Content

Database Software

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Can I use a binding variable to declare a dynamic namespace?

User_H8PVJJan 12 2023

Hi,
I need a way to declare a dynamic namespace in XmlQuery like this:

SELECT XMLQuery('declare namespace ns="$nsVar"; (::)
                 copy $i := $xml
                 modify (insert node attribute xsi:schemaLocation {"$schemaLocation"} into $i/ns:MyNode)
                 return $i'
                 PASSING xml_type AS "xml", nsVar AS "nsVar", schemaLocationVar AS "schemaLocation"
                 RETURNING CONTENT)
INTO xml_type
FROM DUAL;

Is there a way to get this to work? Because I wasn't able to.
Database Version is 19c.
Kind Regards

Comments

Post Details

Added on Jan 12 2023
2 comments
321 views