This week's book giveaway is in the Java in General forum. We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line! See this thread for details.
Handling the exception inside a stored procedure is obviously database specific; you'll probably find the details on your database documentation.
If there is an exception that escapes the stored procedure, it causes an SQLException to be thrown. Again, the details of how this exception is initialized are database specific, but sometimes it is possible to extract useful information from that. For example, in Oracle the SQLException message contains a stack-trace from the PL/SQL code.