PL/SQL (MOSC)

MOSC Banner

How to register xquery functions in oracle?

Hi.

I'm trying to create and use functions locally (example below).

The problem is that I can't reuse them. Whenever I need to use them, I need to redeclare them.

select

 xmlquery ( declare function local:remove-elements-deep ( $nodes as node()* ,

            $names as xs:string* ) as node()* {  for $node in $nodes  return

            if ($node instance of element())

            then

            if (local:name-test(name($node),$names))

            then ()

            else element { node-name($node)}

           { $node/@*, local:remove-elements-deep($node/node(), $names)}

            else

            if ($node instance of document-node())

            then local:remove-elements-deep($node/node(), $names)

            else $node }


How do I register this function in the database and not have to declare them whenever I need to?

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