db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Burlison <Alan.Burli...@sun.com>
Subject Returning NULL from a database-side Java function
Date Tue, 09 Oct 2007 13:52:33 GMT
I have a Java database-side function that does a simple lookup of a 
string on a reference table and returns the corresponding integer.  If 
the string can't be found I want to return NULL, but if I return a Java 
null I get a database exception rather than the desired behaviour:

Error: java.sql.SQLException: The exception 
'java.lang.NullPointerException' was thrown while evaluating an 
expression., SQL State: 38000, Error Code: -1

How do I return a 'database' NULL from a database-side Java function?


Alan Burlison

View raw message