Skip navigation links
Apache Derby 10.11

Package org.apache.derby.vti

Support for Table Functions.

See: Description

Package org.apache.derby.vti Description

Support for Table Functions.

Derby lets you declare functions which return ResultSets. You can then use these function results as tables in your queries. This, in turn, lets you do the following:

Here is an example of how to declare and invoke a Table Function:


CREATE FUNCTION externalEmployees
()
RETURNS TABLE
(
  employeeId    INT,
  lastName       VARCHAR( 50 ),
  firstName      VARCHAR( 50 ),
  birthday         DATE
)
LANGUAGE JAVA
PARAMETER STYLE DERBY_JDBC_RESULT_SET
NO SQL
EXTERNAL NAME 'com.acme.hrSchema.EmployeesTable.read'
;

INSERT INTO employees
  SELECT s.*
    FROM TABLE (externalEmployees() ) s;

The Derby optimizer makes some assumptions about these Table Functions:

Based on these assumptions, the optimizer decides where to place the Table Function in the join order. Using the interfaces in this package, you may override the optimizer's guesses and force the optimizer to choose a better join order.

Skip navigation links
Built on Thu 2014-08-07 10:13:04-0700, from revision 1616546

Apache Derby 10.11 API Documentation - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.