XML Database (MOSC)

MOSC Banner

Need help with an XML function

Oracle 19c

I am trying to write a function that takes an xml column, an xml path, and a new value for that item and replaces the current value with the new value and spits out the updated xml. This is what I have so far but it doesn't work mostly due to my limited understanding to xmlquery and xquery. What am I doing wrong?

CREATE OR REPLACE FUNCTION XMLFUN( XCOL IN XMLTYPE, XNODE IN VARCHAR, NEWVAL VARCHAR )

RETURN XMLTYPE

IS

BEGIN

SELECT XMLQUERY(

'copy $t := . modify(

if( $t'||XNODE||') then

(

replace value of node $t'||XNODE||' with "'||NEWVAL||'"

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center