The XMLCOMMENT function returns an XML value with the input
argument as the content.

>>-XMLCOMMENT--(--string-expression--)-------------------------><
- string-expression
- An expression that returns a value of any built-in character-string
or graphic-string data type. It cannot be CHAR or VARCHAR bit data.
The result of string-expression is parsed to check for conformance
to the content of an XML comment, as specified by the following rules:
- '–' (double hyphen) must not occur in the string expression.
- The string expression must not end with a hyphen ('-').
- Each character of the string can be any of the following characters
as represented by the Unicode code points: #x9, #xA, #xD, #x20-#xD7FF,
#xE000-#xFFFD, #x10000-#x10FFFF.
If string-expression does not conform to the previous
rules, and error is returned.
The result of the function is XML. If the argument can
be null, the result can be null; if the argument is null, the result
is the null value.
Example
- Generate an XML comment.
SELECT XMLCOMMENT('This is an XML comment')
FROM SYSIBM.SYSDUMMY1
This query produces the following result:
<!--This is an XML comment-->