Creating DB2 user-defined functions for XML

You can use a UDF to access and read XML documents. For example, if you want to convert data in an XML document into relational table format, you can create a UDF to perform the conversion. Use the New XML Table Function wizard to create a DB2® table UDF that takes input from the XML document that you specify and returns it in table format for a relational database. With the wizard, you can also specify that you want to run an XSL transformation on the XML document before the data extracts.
Prerequisites:

To create a UDF for XML:

  1. Switch to the Data perspective.
  2. Click File > New > Other to open the New dialog.
  3. Select Data and choose User-Defined Function.
  4. Click Next. The wizard opens.
  5. On the Specify a Project page, choose to use a new project or select an existing data development project.
  6. Click Next. The Name and Language page opens.
  7. In the Language field, select SQL-XML.
  8. Complete the necessary steps of the wizard.
  9. Click Finish.
The user-defined function is created and added to the data development project that you specified, and the user-defined function is deployed and registered on the database server.

Feedback