Trigger

1,768 views

Published on

PL SQL TRIGGER

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,768
On SlideShare
0
From Embeds
0
Number of Embeds
64
Actions
Shares
0
Downloads
121
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Trigger

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

×