XMLTYPE is an XMLType constructor.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
CONSTRUCTOR FUNCTION XMLType(
xmlData IN CLOB)
RETURN SELF AS RESULT;
CONSTRUCTOR FUNCTION XMLType(
xmlData IN VARCHAR2)
RETURN SELF AS RESULT;
Parameters
| Parameter | Description |
|---|---|
| xmlData | The data type of this parameter is CLOB or VARCHAR2. If the input data is a valid XML DOCUMENT text, the constructor returns the XMLType data constructed from this text. |
Examples
In the following example, variable b is a valid XML text, and variable a is of the XMLType type. Line 5, a:=xmltype(b), constructs an XMLType value from b and assigns it to variable a.
obclient> DECLARE
a XMLType;
b VARCHAR2(200):='<?xml version="1.0" encoding="ISO-8859-1"?><note><heading>Reminder</heading></note>';
BEGIN
a:=XMLType(b);
END;
/
Query OK, 0 rows affected
If the input data is not a valid XML DOCUMENT text, an error is returned when the constructor is executed.
obclient> DECLARE
a XMLType;
b VARCHAR2(200):='<?xml version="1.0" encoding="ISO-8859-1"?><note><heading>Reminder</heading></error>';
BEGIN
a:=XMLType(b);
END;
/
OBE-31011: XML parsing failed
at package body oceanbase.XMLTYPE.XMLTYPE , line : 1, col : 0
at anonymous block , line : 5, col : 0
