-20338   THE DATA TYPE OF EITHER THE SOURCE OR TARGET OPERAND OF AN XMLCAST SPECIFICATION MUST BE XML

Explanation

The XMLCAST specification must have one operand that has the data type XML. The XMLCAST operation can be from one the following:
  • an XML type value to an SQL type value
  • from an SQL type value to and XML type value
The XMLCAST specification also accepts having both the source and target operands as XML, but if you specify the source and target operands as XML, then no actual casting operation is performed.

System action

The expression cannot be processed.

Programmer response

If both operands are SQL data types other than XML, then use the CAST specification. Otherwise, change the XMLCAST specification so that at least one operand is the XML data type.

SQLSTATE

42815