XMLPI

The XMLPI function returns an XML value with a single processing instruction node.

Read syntax diagram
>>-XMLPI--(--NAME--pi-name--+----------------------+--)--------><
                            '-,--string-expression-'      

The schema is SYSIBM.

NAME pi-name
Specifies the name of a processing instruction. The name is an SQL identifier that must be in the form of an XML NCName. The name must not contain "xml" in any case combination.
string-expression
An expression that returns a value of a built-in character or graphic string that is not a LOB and is not bit data The resulting string will be converted to UTF-8 and parsed to check for conformance to the content of XML processing instruction as specified by the following rules:
  • The string must not contain the substring '?>' as this terminates a processing instruction.
  • Each character can be any Unicode character, excluding the surrogate blocks, X'FFFE', and X'FFFF'.
If the resulting string does not conform to the preceding rules, an error is returned. The resulting string becomes the contents of the constructed processing instruction node. If string-expression is not specified or is an empty string, the contents of the procession instruction node are empty.

The result of the function is an XML value. The result can be null; if the string-expression argument is null, the result is the null value.

Example: Generate an XML processing instruction node:
   SELECT XMLPI(NAME "Instruction", 'Push the red button')
     FROM SYSIBM.SYSDUMMY1;
The result looks similar to the following results:
   <?Instruction Push the red button?>