| Interface | Description | 
|---|---|
| AwareVTI | 
 Interface describing a table function which can be given information about the context
 in which it runs. | 
| RestrictedVTI | 
 Interface for Table Functions which can be told which columns need to be fetched plus simple bounds on those columns. | 
| VTICosting | 
        VTICosting is the interface that the query optimizer uses
 to cost Table Functions. | 
| VTIEnvironment | 
        VTIEnvironment is the state variable created by the optimizer to help it
        place a Table Function in the join order. | 
| Class | Description | 
|---|---|
| ForeignTableVTI | 
 This class contains a table function which can be used to bulk-import data
 from a foreign database. | 
| ForwardingVTI | 
 This class contains a table function which forwards its behavior to
 another ResultSet wrapped inside it. | 
| Restriction | 
 An expression to be pushed into a Table Function so that the Table Function
 can short-circuit its processing and return fewer rows. | 
| Restriction.AND | An AND of two Restrictions | 
| Restriction.ColumnQualifier | 
 A simple comparison of a column to a constant value. | 
| Restriction.OR | An OR of two Restrictions | 
| StringColumnVTI | 
 This is an abstract table function which assumes that all columns are strings and which
 coerces the strings to reasonable values for various getXXX()
 methods. | 
| VTIContext | 
 Context parameter which is passed to an AwareVTI. | 
| VTITemplate | An abstract implementation of ResultSet that is useful
        when writing table functions, read-only VTIs (virtual table interface), and
        the ResultSets returned by executeQuery in read-write VTI classes. | 
| VTITemplate.ColumnDescriptor | 
 A struct class which is useful for describing columns and parameters. | 
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.
Apache Derby 10.14 API Documentation - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.