Neoview Guide to Stored Procedures in Java (R2.2)
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 Neoview Script” (page 67)
• “Returning Result Sets in an ODBC Client Application” (page 68)
• “Returning Result Sets in a JDBC Client Application” (page 69)
Calling SPJs in Neoview Script
In Neoview Script, 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 Neoview
Script. 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. Neoview Script 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 Script Guide.
Using Named Parameters
In a Neoview Script 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 82).
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
Using Unnamed Parameters
In a Neoview Script session, invoke the SPJ named TOTALPRICE by preparing and executing
a CALL statement. The INOUT parameter accepts a value that is set by the USING clause of the
EXECUTE statement and returns the total price:
SQL>prepare stmt1 from call sales.totalprice(50, 'nextday',?);
--- SQL command prepared.
SQL>execute stmt1 using 2.25;
The output of the prepared CALL statement is:
*** WARNING[11217] Java execution: Data overflow occurred while retrieving data
at parameter position 3. Value is truncated.
PRICE
--------------------
66 Executing SPJs