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

Using Unnamed Parameters
In an NCI 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
--------------------
136.77
--- SQL operation complete.
In an NCI session, invoke the SPJ named TOTALPRICE again by preparing and executing a
CALL statement in which all three parameters accept values that are set by the USING clause of
the EXECUTE statement. The INOUT parameter returns the total price:
SQL>prepare stmt2 from call sales.totalprice(?,?,?);
--- SQL command prepared.
SQL>execute stmt2 using 3, 'economy', 16.99;
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
--------------------
57.12
--- SQL operation complete.
Returning Result Sets in NCI
If a CALL statement returns result sets, NCI displays column headings and data for each returned
result set in the same format as SELECT statements. For example, this CALL statement returns
the number of orders as an output parameter and two result sets in the NCI session:
SQL>call sales.ordersummary('01-01-2001', ?);
NUM_ORDERS
--------------------
13
ORDERNUM NUM_PARTS AMOUNT Order/Date Last Name
---------- -------------- --------------- ---------- ------------------
100210 4 19020.00 2003-04-10 HUGHES
100250 4 22625.00 2003-01-23 HUGHES
101220 4 45525.00 2003-07-21 SCHNABL
200300 3 52000.00 2003-02-06 SCHAEFFER
200320 4 9195.00 2003-02-17 KARAJAN
200490 2 1065.00 2003-03-19 WEIGL
.
.
.
--- 13 row(s) selected.
Calling SPJs in NCI 55