External String Literal Examples - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
jpx1556733107962.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

The following examples demonstrate various UDF external string literals.

Example1: External String Literal Examples

The following example indicates that the source is to be obtained from the client, from absolute directory UDF Source. The file name on the platform and the source file name are both sales.c. The function entry name is sales1 and the function is to be compiled with debug symbols.

   'CS¡sales¡C:\UDF Source\sales.c¡F¡sales1¡D'

Example 2: External String Literal Examples

In the following example, the object is to be obtained from the client. udfdev/imagef.o is the relative path to udfdev/imagef.o from the home or current client directory for the logged on user. The file name on the Teradata Database server is img.o. The name of the object it retrieves is imagef.o, and the function entry name for the UDF is img_match.

   'CO¡img¡/udfdev/imagef.o¡F¡img_match'

Example 3: External String Literal Examples

The following example indicates that the header file udf_types.h and the C source file stdvar.c to be used for the UDF are to be found on the client. /headers/udf_types.h is the relative path from the home or current client directory for the logged on user to the header file and /src/stdvar.c is the relative path to the C source file. The function name in the C source code is called stdvar. Both files have the same name on the platform.

   'CI¡udf_types¡headers/udf_types.h¡CS:stdvar¡src/stdvar.c¡F¡stdvar'

The following table summarizes the naming issues for the EXTERNAL NAME clause and its various components.

Function Name Source File Name Function Name in DBC.TVM C/C++ Function Name Comments
function_name only function_name function_name function_name function_name must be unique within its database.

If you add a new function that has the same function_name within the sam database, then you must specify a different specific_function_name to make the two functions distinct.

function_name and specific_function_name specific_function_name specific_function_name specific_function_name specific_function_name must be unique within its database.
function_name and external_function_name external_function_name function_name function_entry_name specific_function_name must be unique within its database.

If you add a new function that has the same function_name within the sam database, then you must specify a different specific_function_name to make the two functions distinct.

function_name and function_entry_name as part of 'string' source_name as specified in 'string' function_name function_entry_name
function_name and 'string' but no function_entry_name function_name function_name
function_name and specific_function_name and function_entry_name but not as 'string' external_function_name specific_function_name external_function_name specific_function_name must be unique within its database.
function_name and specific_function_name and function_entry_name as 'string' source_name as specified in 'string' function_entry_name if F option is specified
specific_function_name if F option is not specified