Java Stored Procedures Developer's Guide
Release 2 (8.1.6)
Part Number A81358-01
Java exceptions are objects, so they have classes as their types. As with other Java classes, exception classes have a naming and inheritance hierarchy. Therefore, you can substitute a subexception (subclass) for its superexception (superclass).
All Java exception objects support the method
toString(), which returns the fully qualified name of the exception class concatenated to an optional string. Typically, the string contains data-dependent information about the exceptional condition. Usually, the code that constructs the exception associates the string with it.
When a Java stored procedure executes a SQL statement, any exception thrown is materialized to the procedure as a subclass of
java.sql.SQLException. That class has the methods
getMessage(), which return the Oracle error code and message, respectively.
If a stored procedure called from SQL or PL/SQL throws an exception not caught by Java, the caller gets the following error message:
This is how all uncaught exceptions (including non-SQL exceptions) are reported.