This topic describes Table-Valued Functions and how to use them.
Description
A Table-Valued Function (TVF) is a function in TuringSQL that can operate on an entire table. The input to a TVF consists of one or more scalar parameters and an SQL statement that represents a table. The output is a table.
Syntax
SELECT:
SELECT [ DISTINCT ]
{ * | projectItem [, projectItem ]* }
FROM Table({TVF})
[ WHERE booleanExpression ]
[ GROUP BY { groupItem [, groupItem ]* } ]
[ ORDER BY { orderByItem [, OrderByItem ]* }]
[ HAVING booleanExpression ]
[ LIMIT number]
[ OFFSET number]
TVF:
{TVF Name}({scalar parameter}*, {SELECT})Examples
Simple TVF
SELECT
*
FROM
TABLE (
one_part_tvf(
'rtp_url',
123,
(
SELECT i1, i2, d3, d4 FROM t1
)
)
)However, you can use the following methods:
SELECT
*
FROM
TABLE (
one_part_tvf_enable_shuffle(
'rtp_url',
123,
(
SELECT
i1, i2
FROM
TABLE (
one_part_tvf_enable_shuffle(
'rtp_url_2',
234,
(
SELECT i1, i2, d3, d4 FROM t1
)
)
)
)
)
)Built-in TVFs
For more information, see Using TVFs.