Designing external table functions

Just like external scalar functions, we can also have external table functions. The external table functions return a table and can only be used in the FROM clause of a query. Even though it returns a result set, the association between DB2 and the function is at a row level. In other words, instead of returning all of the rows at a time, a function returns one row at a time. In this recipe, we will see how we can implement external table functions where they are defined in high-level languages.

How to do it...

When an external table function is invoked, it can internally make five types of calls to it. To define an external table function, we can get the entire result in the first call and return one row at each ...

Get IBM DB2 9.7 Advanced Application Developer Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.