UDF creation using ODBC - V2R6

Connectivity
N/A

UDF creation using ODBC - V2R6

How to CREATE a UDF in Teradata (V2R6) for the following function in oracle

FUNCTION GET_FAA(P_E_SEQ_ID C.SEQ_ID%TYPE)
RETURN VARCHAR2
AS
V_S VARCHAR2(2000);

CURSOR GET_S IS
SELECT S_CATEGORY||'-'||S_NAME||'-'||S_MOD AS SY
FROM SIDE_EFFS A
WHERE A.SEQ_ID = P_E_SEQ_ID;

BEGIN

FOR LIST IN GET_S LOOP

V_S := V_S||'; '||LIST.SY;

END LOOP;

V_S := SUBSTR(V_S,3);

RETURN(V_S);

EXCEPTION
WHEN OTHERS THEN
V_S := NULL;

RETURN(V_S);

END ;

I would like to call this function within the sql statements of the Teradata SQL.

Any thoughts and ideas will of great help.

Regards,
S
4 REPLIES
Teradata Employee

Re: UDF creation using ODBC - V2R6

In V2R6, Teradata does not support SQL UDFs. They must be written in C/C++ and may not contain embedded SQL statements.

Re: UDF creation using ODBC - V2R6

You have to write the code in C or Java so as to make this function available to SQL statements in Teradata and besides you cannot create UDF via ODBC you have to use bteq to submit a UDF creation request through CLI.
N/A

Re: UDF creation using ODBC - V2R6

Thankyou very much for all your inputs. Is there any work around with SQL to acomplish this.

Many Thanks,
Sony

Re: UDF creation using ODBC - V2R6

You can create a stored procedure to do this in PL/SQL