Link to home
Start Free TrialLog in
Avatar of ElishaMoshe
ElishaMoshe

asked on

Handling Java Exceptions from PL/SQL Code

I loaded a Java class into the DB, and wrapped it with a pl\sql package.

I would like to know if there is a way to catch exceptions thrown by the Java class and handle them in the pl\sql package?

Thanks,
Yoni.
Avatar of Daniel Stanley
Daniel Stanley
Flag of United States of America image

DECLARE
     exc ora_java.jobject;
     . . .
  BEGIN
     [ do some operations ]
  EXCEPTION
     WHEN ORA_JAVA.EXCEPTION_THROWN THEN
        exc := ORA_JAVA.LAST_EXCEPTION;
        MESSAGE(Exception_.getMessage(exc));
        ORA_JAVA.CLEAR_EXCEPTION;
  END;

found this, hope this helps.

daniels
Avatar of ElishaMoshe
ElishaMoshe

ASKER

Hi daniels,

I checked out your suggestion, but it only works in Forms & Reports 9i, not in PL\SQL.

Instead, I found this:
http://www.unix.org.ua/orelly/oracle/guide8i/ch09_08.htm

under:
"9.8.5 Exception Handling with Java".
This looks like it could be useful, even if it is not the most elegant solution...

ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial