1.1 - 8.10 - XMLRelation Example: ErrorHandler - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

This example handles a malformed input document.

Input

The second XML document is malformed.

xmlrelation_error
xid xmldocument
1 <School name="UCLA">

: <Dept name="EE">

: </Dept>

: </School>

2 <School /School> name="UTA">

SQL Call

SELECT * FROM XMLRelation (
  ON xmlrelation_error
  USING
  TextColumn ('xmldocument')
  DocIDColumns ('xid')
  MaxDepth (1)
  ErrorHandler ('true;xmldocument')
) AS dt ;

Output

 xid out_nodeid element attributes value_col d0id d1id errorhandler                  
 --- ---------- ------- ---------- --------- ---- ---- ----------------------------- 
   1          2 Dept    name=EE                 1    2 NULL                         
   1          1 School  name=UCLA               1 NULL NULL                         
   2       NULL NULL    NULL       NULL      NULL NULL <School /School> name="UTA">;

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.