-
mutating table problem
Suppose I have table with following fields
Id
Name
Salary
Bonus
I want to create a trigger to populate bonus field as 10% of salary during insert/update.
However, when I tried to write a trigger I got mutating table error. After consulting a PL/SQL book, I ultimately made a way by using package and a PL/SQL table to track which Ids were inserted/updated and then call another trigger statement to update the Bonus.
Now my question is, why Oracle does the things in this way? SQL Server implements it in much more easy & straigh forward manner.
Thanx
-
-
dear member
this problem is called mutating triggers.this happens with row triggers.the only solution to this is to use statement triggers or go for normalization.u can not rectify the problem wit h row trigger
n santoh
-
! ! ! ! ! !
What's wrong with
:new.bonus := 0.1 * :new.salary;
in a before trigger?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|