Procedures store procedural SQL statements in a database for use by all applications. They can include control statements that allow repetition (LOOP statement) and conditional execution (IF statement and CASE statement) of SQL statements.
Procedures are invoked with a CALL statement, and use parameters to accept values and return values to the calling environment. Procedures can also return result sets to the caller, or call other procedures.
User-defined functions are one kind of stored procedure that returns a single value to the calling environment. User-defined functions do not modify parameters passed to them, but rather, broaden the scope of functions available to queries and other SQL statements.
You can debug stored procedures using the combined stored procedure/Java debugger. For more information, see Appendix C, “Debugging Logic in the Database.”