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!

update trigger on update in same table

whitecatJul 26 2013 — edited Jul 26 2013

Hi guys!

I have a newbie question as am a newbie in this domain:

There is one table : table1 which looks like:

Col1

Col2

row1

     1

row2

     2

row3

     3

I need to write a simple trigger to achieve:


* whenever there is change in row2 for  col2 value ('2') to some other value (e.g. '5') , i need to reset the value back to its original value('2').


I tried writing simple trigger for this but since both operations(original update statement and my trigger update statement) are on same table it throws some error like... cant handle more than 50 recursions or invalid trigger etc.


* also pleas let me know, if there is any other better way around rather than using trigger. Is there any way to monitor at schema level etc. that can track that there has been some data update and then immediately run my update trigger on that...


* 1 idea I can think of is : create another table with same data update it as needed and copy back to original table, but it looks more of work + authority problem too...

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2013
Added on Jul 26 2013
12 comments
1,302 views