1.14.2 XML constructor function

Organization of this subsection
(1) Function
(2) Format
(3) Rules
(4) Example

(1) Function

Generates an XML type value.

(2) Format

XML ( value-expression [AS data-type] )

(3) Rules

  1. The following can be specified as the value expression:
    • SQL variable or SQL parameter
    • Embedded variable or ? parameter
  2. For an XML document, use the XML conversion command or XML conversion library, and specify the resulting ESIS-B format output data type as BINARY.
  3. If the value expression is an embedded variable or a ? parameter, the data type of the value expression must be specified with AS data-type. If AS data-type is specified, no value is permitted other than an embedded variable or a ? parameter.
  4. The data type of the result is the XML type.
  5. If the value expression is the null value, the result is also the null value.
  6. The XML constructor function can appear by itself in the following places:
    • The insertion value of an INSERT statement
    • The update value of an UPDATE statement

(4) Example

The XML document stored in the embedded variable :bookinfo is inserted into BOOK_MANAGEMENT_TABLE.

 INSERT INTO BOOK_MANAGEMENT_TABLE
      VALUES (310494321, XML(:bookinfo AS BINARY(102400)))