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

// Return a result set of rows from the PARTLOC table listing
// locations that have this part in stock and the quantity they
// have on hand.
PreparedStatement getLocations = conn.prepareStatement(
" SELECT * " +
" FROM invent.partloc " +
" WHERE partnum = ? ");
getLocations.setInt(1, partNum);
locations[0] = getLocations.executeQuery();
// Return a result set of rows from the PARTSUPP table listing
// suppliers who supply this part.
PreparedStatement getSuppliers = conn.prepareStatement(
" SELECT * " +
" FROM invent.partsupp " +
" WHERE partnum = ? ");
getSuppliers.setInt(1, partNum);
suppliers[0] = getSuppliers.executeQuery();
// Return a result set of rows from the EMPLOYEE table listing
// sales reps that have sold this part.
PreparedStatement getReps = conn.prepareStatement(
" SELECT * " +
" FROM persnl.employee " +
" WHERE empnum in ( SELECT O.salesrep " +
" FROM sales.orders O, " +
" sales.odetail D " +
" WHERE D.partnum = ? " +
" AND O.ordernum = D.ordernum ) " +
" ORDER BY empnum ");
getReps.setInt(1, partNum);
reps[0] = getReps.executeQuery();
}
Creating the Procedure: PARTDATA
To create this procedure in the SALES schema, upload the Sales.jar file to the Neoview
platform, navigate to the SALES schema in HPDM, and then enter or select these values in the
Create Procedure dialog box of HPDM. For more information, see the HP Database Manager
(HPDM) User Guide.
partdataName:
Sales.jar > Sales > partDataCode:
78 Sample SPJs