Tuesday, April 13, 2010 03:12 PM
Stored procedures are database objects, not Java. You can execute them from Java.
Their advantage is that they run right on the database and if written properly can take advantage of processing sets of records at a time. If you tried to do the same thing in Java you would need to retrieve all the records from the database, then process them iteratively, then usually write the results back to the database. This is way slower and less efficient than having a stored procedure do it right within the database.