Shredding XML documents into tables
DB2 provides two ways of shredding XML documents into tables:
1. Using the XMLTABLE function. This is simpler and seems quite flexible in that it allows transformations and joins during the process too but the only downside is that each target table will need a separate INSERT statement. All the INSERTS can be bunched into an SP to make processing atomic and efficient.
2. Using Annotated Schema Decomposition. In this case, an XML schema is set up with annotations which map the XML elements to relevant table/columns and DB2 uses this info to do the shredding and inserting. Adv is that a single INSERT statement can write to multiple tables and also, the whole thing can be set up using the Data Studio GUI but the overall process can get quite complex.
A nice intro to the two options.
1. Using the XMLTABLE function. This is simpler and seems quite flexible in that it allows transformations and joins during the process too but the only downside is that each target table will need a separate INSERT statement. All the INSERTS can be bunched into an SP to make processing atomic and efficient.
2. Using Annotated Schema Decomposition. In this case, an XML schema is set up with annotations which map the XML elements to relevant table/columns and DB2 uses this info to do the shredding and inserting. Adv is that a single INSERT statement can write to multiple tables and also, the whole thing can be set up using the Data Studio GUI but the overall process can get quite complex.
A nice intro to the two options.
0 Comments:
Post a Comment
<< Home