UDF Compilation

Database
Enthusiast

UDF Compilation

Hi,
I created an UDF in teradata recently.The UDF was created with some warnings.
The following is the UDF and associated C program:

REPLACE FUNCTION DB.GetSum(a integer,b integer)
RETUN INTEGER
SPECIFIC GetSum
LANGUAGE C
NO SQL
PARAMETER STYLE TD_GENERAL
NOT DETERMINISTIC
CALLED ON NULL INPUT
EXTERNAL NAME GetSum

FileName:GetSum.c
#include
include
include
#include
int getSum(int a,int b)
(
return (a+b);
}

But when I call the function in bteq ,on whatever be the input , the output is 0.For example:
SEL DB.GetSum(5,11);
Output: 0

Can anyone rectify , where the mistake is?
what will be the correct program?
1 REPLY
Senior Apprentice

Re: UDF Compilation

If this is yor actual C-source, there's a lot missing :-)

You should start reading the Orange Book on UDFs (http://www.teradata.com/DownloadCenter/Topic9233-132-1.aspx) or the modules about UDFs in "SQL External Routine Programming" manual.
They include some examples.

Dieter