C/C++ User-Defined Functions | SQL External Routine Programming | Vantage - 17.10 - C/C++ User-Defined Functions - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

Teradata provides a wide range of built-in functions that address many of the needs of typical users. In those cases when standard functions are inadequate, Teradata allows you to define user-defined functions (UDFs) that extend the capability of normal SQL within the database.

UDFs are database objects that you build or acquire. For example, you can install UDF objects or packages from third party vendors without providing the source code. A UDF is similar to standard SQL functions such as SQRT, ABS, or TRIM and is invoked in the same manner.

You can write UDFs in C or C++, then compile them into shared objects. Once compiled, you can use the UDF in SQL statements for activities such as enforcing business rules or aiding in the transformation of data.

UDFs execute in parallel within the database. However, the developer of the function can direct which AMPs (virtualized parallel processors) will participate and which AMPs will not. UDFs execute under the control of the AMP and can be very efficient doing row-by-row complex analyses. They are scalable and inherit all of the natural parallelism in Teradata.

You can use UDFs for external I/O, almost any type of data conversion, encapsulating complex business calculations, complex statistical calculations using the aggregate function class, and a wide range of other uses.

Additional details are available at https://www.teradata.com.

For details on writing your own functions in the Java programming language, see Java User-Defined Functions.