Neoview Guide to Stored Procedures in Java (R2.2)

procedure input values, the conversion is from the actual argument value to the formal parameter
type. For stored procedure output values, the conversion is from the actual output value, which
has the data type of the formal parameter, to the declared type of the dynamic parameter.
Input Parameter Arguments
To pass data to an IN or INOUT parameter of an SPJ, specify an SQL expression that evaluates
to a character, date-time, or numeric value. The SQL expression can evaluate to NULL provided
that the underlying Java parameter supports null values. For more information, see “Null Input
and Output” (page 29).
For an IN parameter argument, use one of these SQL expressions in Table 7-1:
Table 7-1 Input Parameter Argument Types
ExamplesType of Argument
CALL adjustsalary(202, 5.5, ?);
CALL dailyorders(DATE '2003-03-19', ?);
CALL totalprice(23, 'nextday' , ?param);
Literal
CALL dailyorders(CURRENT_DATE, ?);
SQL function
(including CASE and
CAST expressions)
CALL adjustsalary(202, ?percent * 0.25, :OUT newsalary);
Arithmetic
expression
CALL totalprice(23, 'next' || 'day', ?param);
Concatenation
operation
CALL totalprice((SELECT qty_ordered
FROM odetail
WHERE ordernum = 100210
AND partnum = 5100),
'nextday', ?param);
Scalar subquery
CALL adjustsalary(?, ?, ?);
CALL adjustsalary(?param1, ?param2, ?param3);
Dynamic parameter
Because an INOUT parameter passes a single value to and accepts a single value from an SPJ,
you can specify only dynamic parameters for INOUT parameter arguments in a CALL statement.
Output Parameter Arguments
Except for result sets, an SPJ returns values in OUT and INOUT parameters. Each OUT or INOUT
parameter accepts only one value from an SPJ. Any attempt to return more than one value to an
output parameter results in a Java exception. See “Returning Output Values From the Java
Method” (page 26).
OUT and INOUT parameter arguments must be dynamic parameters in a client application (for
example, ?) or named or unnamed parameters in Neoview Script (for example, ?param or ?).
For information about how to call SPJs in different applications, see:
“Calling SPJs in Neoview Script” (page 66)
“Calling SPJs From an ODBC Client Application” (page 68)
“Calling SPJs From a JDBC Client Application” (page 69)
Result Sets
Result sets are an ordered set of open cursors that the SPJ method returns to the calling application
in java.sql.ResultSet[] parameter arrays. The java.sql.ResultSet[] parameters do
not correspond with SQL parameters, so you must not include them in the parameter argument
list of a CALL statement.
Using the CALL Statement 65