XMLDOCUMENT

The XMLDOCUMENT function returns an XML value.

Read syntax diagramSkip visual syntax diagramXMLDOCUMENT(,XML-expression)
XML-expression
An expression that returns an XML value.

The result of the function is XML. If the result of XML-expression can be null, the result can be null; if every XML-expression is null, the result is the null value.

Example

  • Insert a constructed document into an XML column.
    INSERT INTO T1 VALUES(123, 
                (SELECT XMLDOCUMENT(
                     XMLELEMENT(NAME "Emp", 
                                       E.FIRSTNME || ' ' || E.LASTNAME, 
                                XMLCOMMENT('This is just a simple example')
                              ))
                    FROM EMPLOYEE E
                    WHERE E.EMPNO = '000120'))