-
Hi,
I am getting ' mutation table' error in a trigger .
I saw one old similar article of 27th march ,but did not see
the appropriate reply to this question.
I have two tables, I want to put After insert trigger into
table T1 where ........
Select T1.car_ctl_nbr into control_number from T1 ,T2 where
T1.car_init = T2.car_init and
T1.car_nbr = T2.car_nbr ;
Update T2 set car_ctl_nbr = control_number ;
When ever I am inserting one record into T1 , I am getting
mutating table error.
I want this to be done for each row.
-
Bind variable
Instead of the select statement I think you are supposed be using the :new.car_ctl_nbr bind variable to update table T2.
-
Select T1.car_ctl_nbr into control_number from T1 ,T2 where
T1.car_init = T2.car_init and
T1.car_nbr = T2.car_nbr ;
Update T2 set car_ctl_nbr = control_number ;
Rewrite u r trigger like this
Dont use the select stmt.
Update T2 set car_ctl_nbr = :New.car_ctl_nbr Where
car_init =:New.car_init And
car_nbr = :New.car_nbr ;
-
Originally posted by kalai
Select T1.car_ctl_nbr into control_number from T1 ,T2 where
T1.car_init = T2.car_init and
T1.car_nbr = T2.car_nbr ;
Update T2 set car_ctl_nbr = control_number ;
Rewrite u r trigger like this
Dont use the select stmt.
Update T2 set car_ctl_nbr = :New.car_ctl_nbr Where
car_init =:New.car_init And
car_nbr = :New.car_nbr ;
Thanks kalai, Great.....
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
|