Oracle SQL XMLElement only outputting (XMLTYPE)

oracle, oracle-sqldeveloper, sql, xml

Solution

There is a setting in the preferences to let it show the actual XML in the Query Results window.

Go to SQL Developer's Tools menu, pick Preferences, expand the Database section, and go to the Advanced section:

Tick 'Display XML Value in Grid', click OK, and re-run your query.

When that option is not set you can still view a single row's actual value by right-clicking on the `(XMLTYPE)` in the grid and choose 'Single record View...`, but unless you're verifying a few large documents that is a bit clunky.

Or, as @WernfriedDomscheit suggested, you can change your query to get the CLOB value from the XMLType instead. (Including `XMLAgg()`, which returns an XMLtype too).

Also, if you run your query as a script (F5) instead of as a statement (control-enter) the XML is displayed in the Script Output window regardless of that setting (since it only applies to the grid view). You may need to `set long` to a higher value to see a useful amount though, as the default is to not show very much at all.

Problem

I have a small query to output XML. CODE: ``` SELECT XMLElement("NAME", e.name) FROM person e ``` Output: ``` XMLELEMENT("NAME,E.NAME) (XMLTYPE) ``` I'm new to the XML side of things in Oracle, why isn't it outputting XML?

Original source