Sonaryr
Sonaryr

Reputation: 1122

Catching PL/SQL errors in JDBC

I'm creating a Java application which connects to an oracle database via JDBC and is able to execute scripts on in. Somewhat like toad. The reason I am creating this is because we can't use Toad or SQLplus in our closed working space.

Everything is working great until I come to procedures,functions,triggers,packages,... (the most important items to say).

I am able to send them trough the JDBC driver, but it always says it is succesfull, even when it wasn't. In SQLplus you get a message saying '.... created with compilation errors', so in fact it isn't a real error either. but then you are able to show the errors.

Is there a way to acces those errors you get with show errors via JDBC? So I atleast now is an error occured.

Upvotes: 1

Views: 1201

Answers (1)

Egor Skriptunoff
Egor Skriptunoff

Reputation: 23747

You can use system view ALL_ERRORS

Example:

select * 
from ALL_ERRORS  
where owner = 'your_schema' 
and name = 'your_package_name' 
and type = 'PACKAGE BODY' 
order by sequence

Upvotes: 2

Related Questions