Description\n-----------\n\nXMLTYPE is a data type introduced in MariaDB 12.3 for storing XML data. It is designed to:\n\n Provide convenient storage of XML data\n Ensure compatibility with Oracle databases\n Support future XML validation and processing capabilities\n\nIn its initial implementatio&#x6E;_,_ XMLTYPE provides basic XML storage capabilities onl&#x79;_,_ without validation or specialized XML-specific functionalit&#x79;_._ When using string functions, the data type is effectively converted to strings and is maintained in temporary tables.\n\nCharacteristics\n\n Maximum storage capacity: 4GB (same as LONGBLOB)\n Compatibilit&#x79;: Designed to be compatible with Oracle’s XMLTYPE\n Validatio&#x6E;: XML validation or schema enforcement is not supported\n Length restrictio&#x6E;: Length cannot be specified.\n\nExample (invalid usage):\n\n``\nCREATE TABLE t1 (a XMLTYPE(6));\n`\n\nXMLTYPE does not accept length parameters, unlike data types such as VARCHAR(255) or DECIMAL(10,2)_._\n\nRelated Functions\n\nWith MariaDB 12.3, the following functions return the XMLTYPE data type:\n\n UPDATEXML&#x20;\n CAST&#x20;\n\nExamples\n\nBasic Tables Creation\n\n`\nCREATE TABLE t1(id INT, x xmltype);\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  id int(11) DEFAULT NULL,\n  x xmltype DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nCharacter Set Specification\n\n`\nCREATE TABLE t1(id INT, x xmltype  CHARACTER SET utf8mb3) CHARACTER SET utf8mb4;\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  id int(11) DEFAULT NULL,\n  x xmltype CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nBinary Attribute\n\n`\nCREATE TABLE t1 (a xmltype binary) CHARACTER SET utf8mb4;\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  a xmltype CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nBasic Data Insertion and Selection\n\n`\nCREATE TABLE t1(id INT, x xmltype);\nINSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');\nSELECT  FROM t1;\n`\n\nOutput\n\n`\nid	x\n1	 one\n2	 two\n3	 three\n`\n\nRestrictions and Error Cases\n\nLength Specification Not Permitted\n\nIf a length parameter is provided for XMLTYPE_,_ the system returns an error:\n\n`\nCREATE TABLE t1 (a XMLTYPE(6));\n`\n\nOutput\n\n`\nERROR HY000: Data type 'XMLTYPE' doesn't support LENGTH attribute.\n`\n\nREF_SYSTEM_ID Attribute Not Supported\n\n`\nCREATE TABLE t1 (a XMLTYPE REF_SYSTEM_ID=4);\n`\n\nOutput\n\n`\nERROR HY000: Data type 'XMLTYPE' doesn't support REF_SYSTEM_ID attribute.\n\n`\n\nLength Parameters in Complex Column Definitions\n\n`\nCREATE TABLE t1(id INT, x xmltype(10, 2));\n`\n\nOutput\n\n`\nERROR HY000: Data type 'xmltype' doesn't support LENGTH attribute.\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/xmltype