db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Waqas Zafar Khan" <a.wax...@gmail.com>
Subject RE: Exceptions in Triggers
Date Tue, 11 Nov 2008 23:08:18 GMT
Hello,

 

I was just wondering what the syntax was for raising an exception in a
trigger, I did a search in the developers manual and only saw this
information:

 

Aborting statements and transactions

You might want a trigger action to be able to abort the triggering statement
or even the entire transaction.

Triggers that use the current connection are not permitted to commit or roll
back the connection, so how do you do that? The answer is: have the trigger
throw an exception, which is by default a statement-level exception (which
rolls back the statement). The application-side code that contains the
statement that caused the trigger to fire can then roll back the entire
connection if desired. Programming triggers in this respect is no different
from programming any database-side JDBC method.

Could the above please be expanded on particularly the point where it
mentions the programming of the exception.

 

Regards,

 

Waqas aka Zafar

 


Mime
View raw message