Im creating a web application using perl and connecting to oracle through DBI.
I have created a few triggers in my database. These triggers can throw various kinds of
application errors depending on different conditions
Code:
create or replace trigger xxx
before insert into table
for each row
begin
// select statement
if (condition1)
then
raise_application_error(-22222, 'error1');
else
// ok
end if
if (condition2)
then
raise_application_error(-22223, 'error1');
else
// ok
end if
end;
my problem is this. If there is an error, how do I find out which error that was thrown?
my perl code is something like this
Code:
$sth = $dbh->prepare(sql statement);
unless ($sth->execute())
{
// error occured
}
// query ok
When I check the error I can print the error message using $DBI::errstr, but I don't want show that on the screen. Is it possible to only display the message I wrote in the raise_application_error statement in my trigger. Or some way of distinguishing the errors.
Any help would be appriciated.