All Forums Extensibility
HP 14 posts Joined 05/08
18 Jun 2015
XPATH query

Hi,
I have installed xml services for teradata 14.00, however i am getting a function does not exists error for SYSXML.XPATH_SHREDV function and I believe its because there may be something wrong i might be giving in the syntax as it is an overloaded function.
does anyone have a working example of the same ?
below sql gives me error 5589 function does not exist.
SELECT * FROM TABLE(SYSXML.XPATH_SHREDV (
'1',
'<CustomerList>
<Customer id=”1001”>
<CustomerName>John Doe</CustomerName>
<Address1>101 Maple Street</Address1>
<City>San Diego</City>
<State>CA</State>
<ZipCode>11111</ZipCode>
</Customer>
<Customer id=”2002”>
<CustomerName>Jane Doe</CustomerName>
<Address1>101 Maple Street</Address1>
<City>San Diego</City>
<State>CA</State>
<ZipCode>11111</ZipCode>
</Customer>
</CustomerList>'
,''
,'/CustomerList/Customer'
,'./@id {1}, ./CustomerName/text() {2}, ./Address1/text() {3}, ./City/text() {4}'
)) TMP;

HP
HP 14 posts Joined 05/08
22 Jun 2015

Hi Folks,
Just following up, does anyone have a working example of a query using SYSXML.XPATH_SHREDV function ?
 

HP

Madhu.k 2 posts Joined 01/15
19 Aug 2015
SELECT b.id, b.Cust_Id, b.Cust_Name
FROM TABLE(sysxml.XPATH_SHREDV
('1'
,'<?xml version="1.0"?>
<customers xmlns:td="http://www.teradata.com/namespace">
<td:customer ID="1">
    <td:C_CUSTKEY>1</td:C_CUSTKEY>
    <td:C_NAME>Usman Ali ø</td:C_NAME>
</td:customer>
</customers>'
,'http://www.teradata.com/namespace as td'
,'/customers/td:customer',
'./td:C_CUSTKEY/text(){1},./td:C_NAME/text(){2}'
)
RETURNS (id VARCHAR(10),Cust_Id VARCHAR(10),Cust_Name VARCHAR(10) character set unicode)
) AS b;

Find the working example
 
 
 

You must sign in to leave a comment.