DB2 Version 10.1 for Linux, UNIX, and Windows

Use Java™ generic table functions for custom analytics

With generic table functions, you can specify the output of a table function when you reference it, rather than when you create it.

To define a generic table function, use the CREATE FUNCTION statement, and specify the RETURNS GENERIC TABLE option. To use this option, you must also specify the LANGUAGE JAVA and PARAMETER STYLE DB2GENERAL options.

After the function is defined, you can access the function output using an SQL select statement, which includes a typed-correlation clause. The typed-correlation clause defines the schema of the result table, including column names and data types. You can use different select statements to output tables of different schemas from the same generic table function.