IBM Books

XML Extender Administration and Programming

Content(): retrieve from XMLFILE to a CLOB

Purpose

Retrieves data from a server file and stores it in a CLOB LOCATOR.

Syntax
XMLFILE to CLOB
>>-Content--(--xmlobj--)---------------------------------------><
 

Parameters

Table 26. XMLFILE to a CLOB parameter
Parameter Data type Description
xmlobj XMLFILE The XML document.

Return type

CLOB (clob_len) as LOCATOR

clob_len for DB2 UDB is 2G.

Example

The following example retrieves data from a server file and stores it in a CLOB locator.

EXEC SQL BEGIN DECLARE SECTION;
     SQL TYPE IS CLOB_LOCATOR xml_buff;
EXEC SQL END DECLARE SECTION;
 
EXEC SQL CONNECT TO SALES_DB
 
EXEC SQL DECLARE cl CURSOR FOR
 
     SELECT Content(order) from sales_tab
     WHERE sales_person = 'Sriram Srinivasan'
 
EXEC SQL OPEN c1;
 
do {
   EXEC SQL FETCH c1 INTO :xml_buff;
   if (SQLCODE != 0) {
      break;
      }
   else {
     /* do with the XML doc in buffer */
     }
   }
 
EXEC SQL CLOSE c1;
 
EXEC SQL CONNECT RESET;

The column ORDER in the SALES_TAB table is of an XMLFILE type, so the Content() UDF retrieves data from a server file and stores it in a CLOB locator.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]