For the complete documentation index, see llms.txt. This page is also available as Markdown.

XMLTYPE

The XMLTYPE data type, available from MariaDB 12.3, for storing XML data.

Introduced

MariaDB 12.3

Syntax

XMLTYPE
  • No parameters accepted

  • Length specification for XMLTYPE (e.g., XMLTYPE(100)) results in an error

Description

XMLTYPE is a data type introduced in MariaDB 12.3 for storing XML data. It is designed to:

  • Provide convenient storage of XML data

  • Ensure compatibility with Oracle databases

  • Support future XML validation and processing capabilities

In its initial implementationn, XMLTYPE provides basic XML storage capabilities onlyy, without validation or specialized XML-specific functionality. When using string functions, the data type is effectively converted to strings and is maintained in temporary tables.

Characteristics

  • Maximum storage capacity: 4GB (same as LONGBLOB)

  • Compatibility: Designed to be compatible with Oracle’s XMLTYPE

  • Validation: XML validation or schema enforcement is not supported

  • Length restriction: Length cannot be specified.

Example (invalid usage):

XMLTYPE does not accept length parameters, unlike data types such as VARCHAR(255) or DECIMAL(10,2).

With MariaDB 12.3, the following functions return the XMLTYPE data type:

  • UPDATEXML

  • CAST

Examples

Basic Tables Creation

Output

Character Set Specification

Output

Binary Attribute

Output

Basic Data Insertion and Selection

Output

Restrictions and Error Cases

Length Specification Not Permitted

If a length parameter is provided for XMLTYPE, the system returns an error:

Output

REF_SYSTEM_ID Attribute Not Supported

Output

Length Parameters in Complex Column Definitions

Output

See Also

Last updated

Was this helpful?