IBM Books

XML Extender Administration and Programming

extractTimestamp() and extractTimestamps()

Purpose

Extracts the element content or attribute value from an XML document and returns the data as TIMESTAMP type.

Syntax
Scalar function
>>-extractTimestamp----(--xmlobj--,--path--)-------------------><
 
Table function
>>-extractTimestamps----(--xmlobj--,--path--)------------------><
 

Parameters

Table 38. extractTimestamp and extractTimestamps function parameters
Parameter Data type Description
xmlobj
XMLVARCHAR,
XMLFILE, or
XMLCLOB

The column name.
path VARCHAR The location path of the element or attribute.

Return type

TIMESTAMP

Returned column name (table function)

returnedTimestamp

Example

This example uses the book sample files. It searches the XML file book.xml for the time specifying when each book was priced and extracts the value as TIMESTAMP.

<?xml version="1.0">
<DOCTYPE book SYSTEM "c:\dxx\samples\book.dtd">
<book>
	<chapter id="1" date="07/01/97">
		<section>This is a section in Chapter One.</section>
	<chapter id="2" date="01/02/1997">
		<section>This is a section in Chapter Two.</section>
	</chapter>
	<price date="12/22/1998" time="11.12.13" timestamp="1998-12-22-11.12.13.888888">
		38.281
	</price>
</book>
 
SELECT db2xml.extractTimestamp(doc, '/book/price/@timestamp') from t1
 


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