SQL/MX 3.2 Guide to Stored Procedures in Java (H06.25+, J06.14+)
Sample SPJs
HP NonStop SQL/MX Release 3.2 Guide to Stored Procedures in Java—691166-001
A-10
Inventory Class
public static void
supplyQuantities(int[] avgQty,
int[] minQty,
int[] maxQty)
throws SQLException
{
Connection conn = DriverManager.getConnection("jdbc:sqlmx:");
PreparedStatement getQty =
conn.prepareStatement("SELECT AVG(qty_on_hand), " +
" MIN(qty_on_hand), " +
" MAX(qty_on_hand) " +
"FROM samdbcat.invent.partloc");
ResultSet rs = getQty.executeQuery();
rs.next();
avgQty[0] = rs.getInt(1);
minQty[0] = rs.getInt(2);
maxQty[0] = rs.getInt(3);
rs.close();
conn.close();
}
}
Example A-3. Inventory.java—The Inventory Class (page2of2)










