Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

Table Valued Functions

Table valued functions make dynamic table query available by allowing calculated stored procedure results to be used in place of a table reference in the FROM clause of a SELECT statement.


Consider a stored procedure that builds a list of customers given a set of parameters:

proc_get_overdue_customers_by_zip (

IN zip CHAR(5),

IN calc_by_days INTEGER


RESULT (last_name CHAR(20), first_name CHAR(20), balance_due MONEY, days_overdue INTEGER)

As a table valued function, this procedure can be directly referenced in your SELECT statement.

SELECT last_name, first_name, balance_due, days_overdue FROM proc_get_overdue_customers_by_zip('65203', 90);