View a SYS.XMLTYPE returned from an Oracle function, using PL/SQL

Posted by caerphilly on Stack Overflow See other posts from Stack Overflow or by caerphilly
Published on 2010-04-01T11:02:00Z Indexed on 2010/04/01 11:23 UTC
Read the original article Hit count: 252

Filed under:
|
|

I have an Oracle function that dynamically creates an XML document, and returns it in a SYS.XMLTYPE value.

I want to run a query from SQL Developer that calls that function and prints the document (either via a select, or dbms_output - I don't care).

But all the examples/documentation seem to refer to querying XML columns in tables, and I can't seem to get the syntax right for my particular usage. I'd like something like this:

declare
   x SYS.XMLTYPE;
begin
   x := my_package.my_function();
   select x.getclobval() from x;  -- doesn't work!
end;

How can I print out the value of the XML type variable 'x' in the above code?

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about Xml