IBM Books

XML Extender Administration and Programming

extractDouble() and extractDoubles()

Purpose

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

Syntax
Scalar function
>>-extractDouble----(--xmlobj--,--path--)----------------------><
 
Table function
>>-extractDoubles----(--xmlobj--,--path--)---------------------><
 

Parameters

Table 31. extractDouble and extractDoubles 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

DOUBLE

Returned column name (table function)

returnedDouble

Example

Table function example:

In the following example, the value of ExtendedPrice in each part of the sales order is extracted as DOUBLE.

SELECT * from table(db2xml.extractDoubles(Order,
   ('c:\dxx\samples\xml\getstart.xml'), '/Order/Part/ExtendedPrice')) as x;

Scalar function example:

The following example automatically converts the price in an order from a DOUBLE type to a DECIMAL.

CREATE TABLE t1(price, DECIMAL(5,2));
INSERT into t1 values (db2xml.extractDouble(db2xml.XMLFile
   ('c:\dxx\samples\xml\getstart.xml'), '/Order/Part/ExtendedPrice')); 
SELECT * from t1;


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