Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You need to refactor the access programs to work through the view instead of invoking the stored procedure. The error codes thrown by the database will change when using a view, so you may need to rework your error handling code. The following code shows how an application would be changed to call the view rather than the stored procedure:
//Before code
stmt.prepareCall("begin ? := getCustomerAccountList(?); end;");
stmt.registerOutParameter(1, OracleTypes.CURSOR);
stmt.setInt(1,customerId);
stmt.execute();
ResultSet rs = stmt.getObject(1);
List customerAccounts = new ArrayList();
while (rs.next()) {
customerAccounts.add(populateAccount(rs));
}
return customerAccounts;
//After code
stmt.prepare(
"SELECT CustomerID, CustomerName, "+
"CustomerPhone, AccountNumber, AccountBalance " +
"FROM CustomerAccountList " +
"WHERE CustomerId = ? ");
stmt.setLong(1,customerId);
ResultSet rs = stmt.executeQuery();
List customerAccounts = new ArrayList();
while (rs.next()) {
customerAccounts.add(populateAccount(rs));
}
return customerAccounts;