The GETCLOBVAL member function returns a CLOB that contains a serialized XML representation. If the returned CLOB is temporary, you must release it after you use it.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
MEMBER FUNCTION getClobVal()
RETURN clob;
Examples
In the following example, a1 and a2 are XMLType variables, c1 is a CLOB variable, c2 is a VARCHAR2 variable, and b is a VARCHAR2 variable. The value of b is a valid XML text <?xml version="1.0" encoding="UTF-8"?><note> <heading>Reminder</heading></note>.
The a1 and a2 variables are generated by using the CREATEXML and XMLTYPE functions, respectively. The a1 and a2 variables can be converted by using the GETCLOBVAL() or GETSTRINGVAL() function and assigned to variables of the corresponding type.
obclient> DECLARE
a1 XMLType;
a2 XMLType;
b VARCHAR2(200):='<?xml version="1.0" encoding="ISO-8859-1"?><note><heading>Reminder</heading></note>';
c1 CLOB;
c2 VARCHAR2(200);
BEGIN
a1:=XMLType.CREATEXML(b);
a2:=XMLType(b);
c1:=a1.GETCLOBVAL();
c2:=a2.GETSTRINGVAL();
DBMS_OUTPUT.PUT_LINE('c1: ' || c1);
DBMS_OUTPUT.PUT_LINE('c2: ' || c2);
END;
/
Query OK, 0 rows affected
