17.00 - Example: Function Mapping Definition with Scalar Subquery (SSQ) Substitution - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Release Date
September 2020
Content Type
Programming Reference
Publication ID
B035-1144-170K
Language
English (United States)

The function mapping definition sessionize_fm specifies a scalar subquery for the TIMEOUT column value:

SELECT timeout FROM ssqtbl WHERE username='John'

If TIMEOUT is not specified during function processing, the column value is resolved by processing the scalar subquery.

CREATE FUNCTION MAPPING sessionize_fm FOR sessionize SERVER coprocessor
USING
InputTable IN TABLE,
ModelTable IN TABLE,
ClusterTable OUT TABLE,
TIMECOLUMN,
TIMEOUT(SELECT timeout FROM ssqtbl WHERE username='John'),
CLICKLAG,
EMITNULL;