JUDF null input handling

General
Enthusiast

JUDF null input handling

Hi,

i was trying to write a simple udf with java with an input argumentn of type string which sometimes also expect null inputs. Whenever I got a null  input it gives the error even I tried it with return null on null input option. Can someone please suggest me that how to handle it. Thanks

Waqas

Tags (2)
2 REPLIES
Enthusiast

Re: JUDF null input handling

Here is my sample code of JUDF which might give an idea to understand what I am trying to do

public class NullInputTest {

public static String nullInputTest(String input) {
if(input==null)
return null;
String returnValue = null;
returnValue=input.concat(" added part");
// TODO Auto-generated method stub

return returnValue;
}

}

And here is generated SQL by Eclipse itself

REPLACE FUNCTION "TEST"."nullInputTest"(

"input"VARCHAR(512))

RETURNS VARCHAR(512)

SPECIFIC "nullInputTest"

LANGUAGE JAVA

NO SQL

PARAMETERS STYLE JAVA

DETERMINISTIC

RETURN NULL ON NULL INPUT

EXTERNAL NAME 'NullInputTestJarId:NullInputTest.nullInputTest(java.lang.String)returns java.lang.String';

Enthusiast

Re: JUDF null input handling

Ahh..it looks like an issue in Eclipse Teradata plugin. It works fine with in the database envoirnment. :)