Oracle8i Java Stored Procedures Developer's Guide
Release 8.1.5

A64686-01

Library

Product

Contents

Index

Prev  Chap Top Next

How Exceptions Are Handled

Java exceptions are objects, so they have classes as their types. Like 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 getErrorCode() and getMessage(), which return the Oracle error code and message, respectively.

If a stored procedure called from SQL or PL/SQL throws an exception that is not caught by Java, the caller gets an exception thrown from Java error message. This is how all uncaught exceptions (including non-SQL exceptions) are reported.




Prev

Top

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index