1.1.1

Table Of Contents
A SQLFire table function is materialized by a public static method that returns a ResultSet:
public static ResultSet read() {...}
The public static method is then bound to a SQLFire function name:
CREATE FUNCTION externalEmployees
()
RETURNS TABLE
(
employeeId INT,
lastName VARCHAR( 50 ),
firstName VARCHAR( 50 ),
birthday DATE
)
LANGUAGE JAVA
PARAMETER STYLE DERBY_JDBC_RESULT_SET
READS SQL DATA
EXTERNAL NAME 'com.acme.hrSchema.EmployeeTable.read'
To invoke a table function, wrap it in a TABLE constructor in the FROM list of a query. Note that the table alias
(in this example "s") is a required part of the syntax:
INSERT INTO employees
SELECT s.*
FROM TABLE (externalEmployees() ) s;
Preferred getXXX() methods for SQLFire Table Functions
While scanning a table function, SQLFire calls a preferred getXXX() method for each column, based on the
column's data type.
The following table lists the preferred getXXX() method for each SQLFire data type.
Table 3: getXXX() Methods Called for Declared SQL Types
getXXX() Method Called by
SQLFire for JDBC 3.0 and
4.0Column Type Declared by CREATE FUNCTION
getLong()BIGINT
getBlob()BLOB
getString()CHAR
getBytes()CHAR FOR BIT DATA
getClob()CLOB
getDate()DATE
getBigDecimal()DECIMAL
getDouble()DOUBLE
getDouble()DOUBLE PRECISION
getDouble()FLOAT
getInt()INTEGER
getString()LONG VARCHAR
getBytes()LONG VARCHAR FOR BIT DATA
vFabric SQLFire User's Guide108
Managing Your Data in vFabric SQLFire