16.20 - External Body Reference Clause - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Detailed Topics

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1184-162K
Language
English (United States)

The required external body reference clause declares that the function is external to Teradata Database and identifies the location of all the file components it needs to be able to run.

An external function name is optional. When it is specified, it must be the name of the C or C++ source code file on the client system to be retrieved and compiled as part of the CREATE FUNCTION or REPLACE FUNCTION process.

If the external function name alone is not sufficient to specify the location of all the function components, you must specify a string literal that explicitly specifies the path to each of those elements. See External String Literal.

In all cases, function_name is the identifier you specify when you invoke the function from SQL statements.

You can optionally specify either or both of the following options for this clause:
  • External function name
  • Parameter style
You can specify an external function name in several different ways. See the following for details:

The following table summarizes the options you can specify in this clause.

IF CREATE FUNCTION specifies this clause … THEN …
EXTERNAL
  • If you specify the SPECIFIC clause, then the C or C++ function name must match the specific_function_name.
  • If you do not specify the SPECIFIC clause, then the C or C++ function name must match the function_name.

If the client is mainframe-attached, then the C or C++ function name must be the DDNAME for the source.

EXTERNAL NAME external_function_name the C or C++ function name must match function_name.

If the client is mainframe-attached, then function_name must be the DDNAME for the source.

EXTERNAL NAME 'string' 'string' can specify the C or C++ function name by stipulating the F option with a function_entry_name, which must match the name of the C or C++ function.

The maximum length of 'string' is 1,000 characters.

You cannot specify the F option in ‘string'without also specifying an include, library, object, package, or source file name. Teradata Database needs one or more of these file names to link to.

If 'string' does not stipulate a function_entry_name, then the following rules apply to the C or C++ function name.

  • If you specify the SPECIFIC clause, the C or C++ function name must match the specific_function_name.
  • If you do not specify the SPECIFIC clause, the C or C++ function name must match the function_name.

For more information, see Teradata Vantage™ SQL External Routine Programming , B035-1147 .

Note that these specifications cannot be used for Java external procedures.

You can specify the parameter style for the function either in this clause or in the Optional Function Characteristics clause, but you can only specify the parameter style for a function one time in its definition. See Parameter Style Clause for more information.