Neoview Guide to Stored Procedures in Java (R2.5)
CALL sales.lowerprice();
If the SPJ has one IN parameter, one OUT parameter, and two result sets, you must list the IN
and OUT parameters but not the result sets in the argument list:
CALL sales.ordersummary('01-01-2001', ?);
Data Conversion of Parameter Arguments
Neoview SQL performs an implicit data conversion when the data type of a parameter argument
is compatible with but does not match the formal data type of the stored procedure. For stored
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 value expression that
evaluates to a character, date-time, or numeric value. The SQL value expression can evaluate to
NULL provided that the underlying Java parameter supports null values. For more information,
see “Null Input and Output” (page 27).
For an IN parameter argument, use one of these SQL value 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
For more information about SQL value expressions, see the Neoview SQL Reference Manual. For
guidelines on defining character string literals for the Neoview character set configurations and
SQL character set column definitions, see the Neoview Character Set Administrator's Guide.
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 24).
Using the CALL Statement 53