(block of code in an order processing transaction)
declare
pragma autonomous_transaction;
begin
(block of code in the autonomous transaction,
which is an inventory update routine)
commit;
end;
(block of code in the order processing transaction
commit;
end; This is all simple enough. Most procedure calls look like this, more or less. Now let's add a trigger, and just to demonstrate the power of the feature, let's make the trigger itself autonomous: create or replace trigger inv_ari
after insert on order
for each row
declare
pragma autonomous_transaction;
begin
(block of code in the autonomous transaction)
commit;
end; The pragma autonomous_transaction is now part of the trigger definition, which is used in the parent transaction. Now you have a trigger in your initial transaction that executes an independent transaction and commits it without committing anything in the parent transaction, making it capable of independent rollback. That is one powerful batch of code.
Enterpise newsletter. Find out what's where in the new Tech Update with our
Guided Tour. Tell us what you think in the
Enterprise Mailroom.
- « Previous
- 1
- 2
Related stories
Post your comment
In order to post a comment you need to be registered and logged in.
You can also log in with Facebook. Log in or create your ZDNet UK account below
By signing up for this service, you indicate that you agree to our Terms and Conditions and have read and understood our Privacy Policy. Questions about membership? Find the answers in the Community FAQ






