Re: Update col to Y set all other to N in trigger.

  • From: Dominic Brooks <dombrooks@xxxxxxxxxxx>
  • To: "post.ethan@xxxxxxxxx" <post.ethan@xxxxxxxxx>
  • Date: Fri, 31 Jan 2020 07:21:58 +0000

Definitely not an autonomous transaction!
Use a compound trigger, store the relevant information in a collection for each 
row, at the end of the statement sort out the non default rows.

http://stevenfeuersteinonplsql.blogspot.com/2016/12/get-rid-of-mutating-table-trigger.html?m=1

Sent from my iPhone

On 30 Jan 2020, at 23:53, Ethan Post <post.ethan@xxxxxxxxx> wrote:


I should recall how to do this but been a while.

I need the best way to

update foo set col='Y' where pk=1;

And have a trigger automatically...

update foo set col='N' where pk !=1;

While avoid mutating table error.

This one seems hard to google the answer to.

Thanks,
Ethan
e-t-h-a-n.com<http://e-t-h-a-n.com>
@poststop

Other related posts: