16.20 - Calling Teradata Library Functions - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

Calling most of the Teradata library functions in an external stored procedure that uses CLIv2 involves several expensive context switches because the external stored procedure uses a different interface mode to execute most of the Teradata library functions.

Additionally, some of the Teradata library functions require that the external stored procedure wait for any outstanding CLIv2 requests to complete before calling them.

The exceptions are FNC_malloc and FNC_free, which do not incur any additional overhead.

The best practice for an external stored procedure that use CLIv2 to execute SQL is to use Teradata library functions judiciously.

For details on which library functions must wait for outstanding CLIv2 requests to complete before they are called, see C Library Functions.