Press "Enter" to skip to content

Xmlelement function in Oracle

Xmlelement function Oracle usage example:

Select Xmlelement(“Empname”, Ename) from Emp where ecode = 7654;

It will return xmltype data in the following format:

Result
————————————
<Empname>Scott</Empname>

If you want this result in character datatype:

Select Xmlelement(“Empname”, Ename).getstringval() from Emp where ecode = 7654;

Result will be the same as above but in character string.