A stored procedure is part of the logic of your application that executes on a database server. Depending on the DBMS, you code procedures in a SQL dialect or a programming language. Stored procedures use distributed processing. When a SQL client invokes a stored procedure, control is transferred to the server. The server executes the procedure and optionally returns data to the client.
Procedures can return output parameters, and sometimes query result sets.
Stored procedures minimize network round-trips between the client and server and they improve performance by decreasing network latency. Database administrators also use procedures to provide security. For example, you can give a user the right to execute a procedure that processes an order without giving the user rights to view or change order tables. The syntax for executing a procedure varies, but there is a standard syntax you can use with JDBC drivers, ODBC drivers, and OLE DB providers. The Crystal Ball Industry pundits seem to think that Java is good for nothing more than creating applets.