If you can do the data manipulation with SQL in a
JDBC Statement (or PreparedStatement),
you should do that. For example, you can sort and search using SQL. It's *much* faster and *much* easier that getting unordered, unfiltered data and sorting and searching in Java, because that's what a database is optimized to do.
In the rare instance that you feel you must do something programatically, you might want to double check with someone with more SQL experience, just in case there's are clever way to do it, using unions or nested queries, for example. If there isn't a way to do it with SQL, and performance isn't a big issue, try processing the data in your Java program, rather than adding an additional level of complexity by using stored procedures (either Java or PL/SQL).
If you seriously need performance, only then use stored procedures. (Depending on how much it interacts with the database, and how powerful the db server is, a stored proceduure can be an order of magnitude faster or more than an external program.) Java stored procedures are a bit slower than PL/SQL but they have the benefit that you can develop them outside the database, within your program and then later deploy in the database as stored procedures if it proves necessary for performance.
@D
[ August 02, 2003: Message edited by: David Gallardo ]