Purpose
Extracts the element content or attribute value from an XML document and returns the data as TIME type.
Syntax
Scalar function |
---|
>>-extractTime----(--xmlobj--,--path--)------------------------>< |
Table function |
---|
>>-extractTimes----(--xmlobj--,--path--)----------------------->< |
Parameters
Table 37. extractTime and extractTimes 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
TIME
Returned column name (table function)
returnedTime
Example
This example uses the book sample files. It searches the XML file book.xml for the time at which books were priced and returns the values as TIME.
<?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.extractTime(doc, '/book/price/@time') from t1