Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Trigger
1. 1
Can you use a commit statement within a database trigger?
? I have never seen a commit on triggers. Triggers as you know are a last line defense based on
an action that was carried out by an insert,update or delete. Hence, since the trigger exists on the
server, and is only fired if one of the above conditions are executed then it seems pointless to use
a commit in the trigger. Also commit goes along nicely with transactions where you begin the
transaction and if all is well then you issue a commit, else if the transaction fails, then you issue a
rollback.
? As per Trigger's restrictions, we can not use any transaction control statement(like commit,rollback,savepoint
etc.) into the body of a trigger.
But oracle provides a facility called Autonomous Transactions through which you can achive this.You add the
that piece of the code, which contains commit, in some block and make that block as Autonomous Transaction
and call or use that block into your trigger.
? One cannot