IBM Books

XML Extender Administration and Programming


XML Extender user-defined functions

The XML Extender provides functions for storing, retrieving, searching, and updating XML documents, and for extracting XML elements or attributes. Use XML user-defined functions (UDFs) for XML columns, but not for XML collections. All the UDFs have the schema name db2xml, which can be omitted in front of UDFs.

The four types of XML Extender functions are: storage functions, retrieval functions, extracting functions, and an update function.

storage functions
Storage functions insert XML documents into a DB2 database. For syntax and examples, see Storage functions.

retrieval functions
Retrieval functions retrieve XML documents from XML columns in a DB2 database. For syntax and examples, see Retrieval functions.

extracting functions
Extracting functions extract and convert the element content or attribute value from an XML document to the data type that is specified by the function name. The XML Extender provides a set of extracting functions for various SQL data types. For syntax and examples, see Extracting functions.

update function
The Update() function modifies the element content or attribute value and returns a copy of an XML document with an updated value that is specified by the location path. The Update() function allows the application programmer to specify the element or attribute that is to be updated. For syntax and examples, see Update function.

Table 21 provides a summary of the XML Extender functions.

Table 21. The XML Extender user-defined functions
Type Function
Storage functions XMLVarcharFromFile()
XMLCLOBFromFile()
XMLFileFromVarchar()
XMLFileFromCLOB()
Retrieval functions Content(): retrieve from XMLFile to a CLOB
Content(): retrieve from XMLVarchar to an external server file
Content(): retrieve from XMLCLOB to an external server file
Extracting functions extractInteger() and extractIntegers()
extractSmallint() and extractSmallints()
extractDouble() and extractDoubles()
extractReal() and extractReals()
extractChar() and extractChars()
extractVarchar() and extractVarchars()
extractCLOB() and extractCLOBs()
extractDate() and extractDates()
extractTime() and extractTimes()
extractTimestamp() and extractTimestamps()
Update function Update()


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