
XML variables are defined in host languages as a type of LOB variable.
Like LOBs, an XML variable can be defined as a string, locator, or file reference variable. It can be treated as CLOB, DBCLOB, or BLOB data. XML-supported CCSIDs can be assigned for CLOB and DBCLOB variables. This value is used to define the encoding of the XML data stored within the LOB variable. An XML variable defined as a BLOB will contain data that is encoded as specified within the data according to the XML 1.0 specification for determining encoding. For example, an XML variable that uses a CLOB storage structure can be defined in C as follows:
SQL TYPE IS XML AS CLOB(10K);Although the application's XML variable declaration includes a LOB type specification, the variable declarations are considered the XML data type, not the LOB type that is used in the declaration. The application can also use non-XML variables in place of XML variables. For example, when a prepared statement is executed, the application might use a character variable to replace an XML parameter marker in the statement.
Although the XML data type is incompatible with all other data types, both XML and non-XML data types can be used for input to and output from XML data. Applications can use character, Unicode graphic, or binary variables as input or output variables in SQL statements.
Whenever an XML variable is used as input to an SQL statement, the value is implicitly parsed.
