Start of change

XMLCAST specification

The XMLCAST specification returns the cast operand (the first operand) cast to the XML data-type.

Read syntax diagramSkip visual syntax diagram
>>-XMLCAST--(--+-expression-------+--AS--data-type--)----------><
               +-NULL-------------+                     
               '-parameter-marker-'                     

Read syntax diagramSkip visual syntax diagram
data-type

|--+-built-in-type-+--------------------------------------------|
   '-distinct-type-'   

built-in-type

|------XML--+--------------+------------------------------------|
            '-ccsid-clause-'       

ccsid-clause

|--CCSID--integer--+------------------+-------------------------|
                   '-normalize-clause-'   

normalize-clause

   .-NOT NORMALIZED-.   
|--+----------------+-------------------------------------------|
   '-NORMALIZED-----'   

expression
Specifies that the cast operand is an expression other than NULL or a parameter marker. It must have a data type of XML. The result is the argument value converted to the specified XML target data type and CCSID.
NULL
Specifies that the cast operand is the null value. The result is a null value that has the XML data type.
parameter-marker
A parameter marker (specified as a question mark character) is normally considered an expression, but is documented separately in this case because it has a special meaning. If the cast operand is a parameter-marker, the XML data type is considered a promise that the replacement will be assignable to the XML data type. Such a parameter marker is called a typed parameter marker. Typed parameter markers will be treated like any other typed value for the purpose of DESCRIBE of a select list or for column assignment.
data-type
Specifies the data type of the result. The data type must be XML or a distinct type based on XML.

If the CCSID attribute is not specified, then the CCSID value as specified by the SQL_XML_DATA_CCSID QAQQINI setting is used. See XML Values for more information.

If the CCSID attribute is specified, the data will be converted to that CCSID. If NORMALIZED is specified, the data will be normalized.

Example

End of change