|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 10/10/2007 1:54:00 AM
Posts: 7,
Visits: 1
|
|
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
|
|
|
|
|
Supreme Being
      
Group: PAC and SFT Members
Last Login: Today @ 6:11:07 PM
Posts: 331,
Visits: 533
|
|
|
In V2R6, Teradata does not support SQL UDFs. They must be written in C/C++ and may not contain embedded SQL statements.
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 7/18/2008 2:51:53 AM
Posts: 7,
Visits: 324
|
|
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.
Regards,
Fawad Asrar Qureshi
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 10/10/2007 1:54:00 AM
Posts: 7,
Visits: 1
|
|
Thankyou very much for all your inputs. Is there any work around with SQL to acomplish this.
Many Thanks, Sony
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 7/18/2008 2:51:53 AM
Posts: 7,
Visits: 324
|
|
You can create a stored procedure to do this in PL/SQL
Regards,
Fawad Asrar Qureshi
|
|
|
|