To invoke a Java-SQL method, which returns a single value, use the following syntax:
method_call ::= member_reference ([parameters]) | new java_sql_class_name ([parameters])
parameters ::= parameter [(, parameter)...]
parameter ::= expression
An invocation of a static method, instance method, or class constructor. A method call can be used in an expression where a non-constant value of the method’s datatype is required.
A member reference that denotes a method.
The list of parameters to be passed to the method. If there are no parameters, include empty parentheses.
When there are methods with the same name in the same class or instance, the issue is resolved according to Java method overloading rules.
The datatype of a method call is determined as follows:
If a method call specifies new, its datatype is that of its Java-SQL class.
If a method call specifies a member reference that denotes a type-valued method, then the datatype of the method call is that type.
If a method call specifies a member reference that denotes a void static method, then the datatype of the method call is SQL integer.
If a method call specifies a member reference that denotes a void instance method of a class, then the datatype of the method call is that of the class.
To include a parameter in a member reference when the parameter is a Java-SQL instance associated with another database, you must ensure that the class name associated with the Java-SQL instance is included in both databases. Otherwise, an exception is raised.
The runtime result of a method call is as follows:
If a method call specifies a member reference whose runtime value is null (that is, a reference to a member of a null instance), then the result is null.
If a method call specifies a member reference that denotes a type-valued method, then the result is the value returned by the method.
If a method call specifies a member reference that denotes a void static method, then the result is the null value.
If a method call specifies a member reference that denotes a void instance method of an instance of a class, then the result is a reference to that instance.
The method call and result of the method call are associated with the same database.
Adaptive Server does not pass the null value as the value of a parameter to a method whose Java type is scalar.