The GETCLOBVAL member function returns a CLOB that contains a serialized XML representation. If a temporary CLOB is returned, it must be released after use.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
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 whose content is a piece of valid XML text <?xml version="1.0" encoding="UTF-8"?><note> <heading>Reminder</heading></note>.
The values of a1 and a2 are generated by using the CREATEXML and XMLTYPE constructors, respectively. a1 and a2 can be converted by using the GETCLOBVAL() or GETSTRINGVAL() function, and their values are assigned to variables of the corresponding types.
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