Neoview Guide to Stored Procedures in Java (R2.2)
java.sql.PreparedStatement ps3 = conn.prepareStatement(s);
ps3.setString(1, onOrAfter);
detail[0] = ps3.executeQuery();
}
Creating the Procedure: ORDERSUMMARY
To create this procedure in the SALES schema, upload the Sales.jar file to the Neoview
platform, navigate to the SALES schema in DB Admin, and then enter or select these values in
the Create Procedure Wizard of DB Admin. For instructions, see “Uploading SPJ JAR Files to
the Neoview Platform” (page 35) and “Creating SPJs” (page 43).
ordersummaryName:
Sales.jar > Sales > orderSummaryCode:
• First SQL parameter:
— Name: on_or_after_date
— Direction: IN
— SQL Data Type: VARCHAR
◦ Length: 20
◦ Upshift: not selected
◦ Character set: ISO88591
— Java Data Type: java.lang.String
• Second SQL parameter:
— Name: num_orders
— Direction: OUT
— SQL Data Type: LARGEINT
— Java Data Type: long[]
Parameters:
• Dynamic result sets: 2
• Accesses Database: selected
Attributes:
Calling the Procedure: ORDERSUMMARY
To invoke the ORDERSUMMARY procedure in Neoview Script:
SQL>call sales.ordersummary('01-01-2001', ?);
The ORDERSUMMARY procedure returns this information about the orders on or after the
specified date, 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
... ... ... ... ...
--- 13 row(s) selected.
ORDERNUM PARTNUM UNIT_PRICE QTY_ORDERED PARTDESC
-------- ------- ---------- ----------- ------------------
100210 244 3500.00 3 PC GOLD, 30 MB
100210 2001 1100.00 3 GRAPHIC PRINTER,M1
100210 2403 620.00 6 DAISY PRINTER,T2
... ... ... ... ...
--- 70 row(s) selected.
--- SQL operation complete.
Procedures in the SALES Schema 89