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

OUT and INOUT parameter arguments must be dynamic parameters in a client application (for
example, ?) or named or unnamed parameters in NCI (for example, ?param or ?).
For information about how to call SPJs in different applications, see:
“Calling SPJs in NCI” (page 54)
“Calling SPJs From an ODBC Client Application” (page 56)
“Calling SPJs From a JDBC Client Application” (page 57)
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.
The calling application can retrieve multiple rows of data from the java.sql.ResultSet[]
parameters. For information about how to process result sets in different applications, see:
“Returning Result Sets in NCI” (page 55)
“Returning Result Sets in an ODBC Client Application” (page 56)
“Returning Result Sets in a JDBC Client Application” (page 58)
Calling SPJs in NCI
In NCI, you can invoke an SPJ by issuing a CALL statement directly or by preparing and executing
a CALL statement.
Use named or unnamed parameters anywhere in the argument list of an SPJ invoked in NCI. A
named parameter is set by the SET PARAM command, and an unnamed parameter is set by the
USING clause of the EXECUTE statement.
You must use a parameter for an OUT or INOUT parameter argument. NCI displays all output
parameter values and result sets after you issue the CALL statement. The procedure call does
not change the value of a named parameter that you use as an OUT or INOUT parameter.
For more information about named and unnamed parameters, see the Neoview Command Interface
(NCI) Guide.
Using Named Parameters
In an NCI session, invoke the SPJ named TOTALPRICE, which has two IN parameters and one
INOUT parameter. This SPJ accepts the quantity, shipping speed, and price of an item, calculates
the total price, including tax and shipping charges, and returns the total price. For more
information, see the “TOTALPRICE Procedure” (page 75).
Set the input value for the INOUT parameter by entering a SET PARAM command before calling
the SPJ:
SQL>set param ?p 10;
SQL>call sales.totalprice(23, 'standard', ?p);
The CALL statement returns the total price of the item:
*** WARNING[11217] Java execution: Data overflow occurred while retrieving data
at parameter position 3. Value is truncated.
p
--------------------
253.96
--- SQL operation complete.
The value of the named parameter, ?p, changes from 10 to the returned value, 253.96:
SQL>show param
p 253.96
54 Executing SPJs