Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

triggers commit on outer transaction irrespective of inner transaction

907301Jun 29 2017 — edited Jun 30 2017

Hi,

I'm working on a db related task and struck with a trigger update.

I have 3 tables table t1, t2, t3. T1 is my master table. T2 is staging table and T3 is table at other schema.

Whenever there is a new entry on T1, it should be logged to T2 and T2 will update T3 based on various validation checks.

My current trigger is written as whenever there is any insert or update on T1, then make an entry to T2 and it updates T3.

However, when insert on T3 fails, the main insert on T1 is also rolled back. For me the transaction on T1 should always be successful(commit) irrespective of T3.

Hence, I thought to log the failed details in a staging table T2.

So that trigger on T1 will be inserting to T2 and Trigger on T2 will insert to T3. Even though if T3 insert fails transaction the transaction on T1 should be committed and completed.

T2 will be used to log whether the insert on T3 is success or failure.

I only have permission to proceed with triggers. Is there any way to succeed this with triggers?

I read about the autonomous_transaction but it doesn't seem to be working on this scenario.

can someone please help me. I'm using oracle 12c.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2017
Added on Jun 29 2017
4 comments
600 views