Null values as arguments to Java-SQL methods

The outcome of passing null as a parameter is independent of the actions of the method for which it is an argument, but instead depends on the ability of the return datatype to deliver a null value.

You cannot pass the null value as a parameter to a Java scalar type method; Java scalar types are always non-nullable. However, Java object types can accept null values.

For the following Java-SQL class:

public class General implements {
 	public static int identity1(int I) {return I;}
 	public static java.lang.Integer identity2
   	  (java.lang.Integer I) {return I;}
 	public static Address identity3 (Address A) {return A;}

Consider these calls:

declare @I int
declare @A Address;

select @I = General.identity1(@I)
select @I = General.identity2(new java.lang.Integer(@I))
select @A = General.identity3(@A)

The values of both variable @I and variable @A are null, since values have not been assigned to them.

A successful call of identity1( ) never returns a null result because the return type has no null state. A null cannot be passed directly because the method resolution fails without parameter type information.

Successful calls of identity2( ) and identity3( ) can return null results.