|
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.
|