A code that represents the programming language in which the external function is written.
This is a mandatory attribute for all UDFs.
The valid languages for writing external UDFs are C, C++, and Java.
If the external function object is not written in C, C++, or Java, it must be compatible with C, C++, or Java object code.
See the CREATE FUNCTION/REPLACE FUNCTION topic “Language Clause” in Teradata Vantage™ SQL Data Definition Language Detailed Topics , B035-1184 .
- C
- The external function is written in C, even if the external function is in object form.
- CPP
- The external function is written in C++, even if the external function is in object form.
- JAVA
- The external function is written in Java.
- SAS
- The external function is written in SAS, which must use the SQLTABLE parameter style.
Example: Java Table UDF
The following example shows two different ways to create a definition for a table function. The functions behave identically.
Note the void return type and usage of return parameter types for the Java method signature in this example, which is different from that of scalar and aggregate UDFs. The difference is necessary because of the possibility of multiple returned column values from the table UDF.
CREATE FUNCTION mytableudf ( p1 INTEGER ) RETURNS TABLE (c1 INTEGER, c2 INTEGER) LANGUAGE JAVA NO SQL PARAMETER STYLE JAVA EXTERNAL NAME 'UDF_JAR:UserDefinedFunctions.mytableudf'; public static void mytableudf(int i, int[] ret1, int[] ret2) throws SQLException CREATE FUNCTION mytableudf ( p1 INTEGER ) RETURNS TABLE (c1 INTEGER, c2 INTEGER) LANGUAGE JAVA NO SQL PARAMETER STYLE JAVA EXTERNAL NAME 'UDF_JAR:UserDefinedFunctions.mytableudf(int, int[],int[])'; public static void mytableudf(int i, int[] ret1, int[] ret2) throws SQLException
Example: Table Operator Function Written in SAS
This table operator function is written in SAS, which uses the SQLTABLE parameter style.
CREATE FUNCTION sas_transform ( RETURNS TABLE VARYING USING FUNCTION LANGUAGE SAS PARAMETER STYLE SQLTABLE DETERMINISTIC RETURN 'optional SAS code text' EXTERNAL NAME 'sas_transform_udf:sas_transform_UDF.GetSASCodeText';