DB2 Version 9.7 for Linux, UNIX, and Windows

XMLPI scalar function

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

The schema is SYSIBM. The function name cannot be specified as a qualified name.

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

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 (SQLSTATE 42634). See the W3C XML namespace specifications for more details on valid names. The name cannot be the word 'xml' in any case combination (SQLSTATE 42634).
string-expression
An expression that returns a value that is a character string. The resulting string is converted to UTF-8 and must conform to the content of an XML processing instruction as specified in XML 1.0 rules (SQLSTATE 2200T):
  • The string must not contain the substring '?>' since this substring terminates a processing instruction
  • Each character of the string can be any Unicode character excluding the surrogate blocks, X'FFFE' and X'FFFF'.

The resulting string becomes the content of the constructed processing instruction node.

The data type of the result is XML. If the result of string-expression can be null, the result can be null; if the result of string-expression is null, the result is the null value. If string-expression is an empty string or is not specified, an empty processing instruction node is returned.

Examples: