When the mutating error will comes? and how it will be
resolved?

Answers were Sorted based on User's Feedback



When the mutating error will comes? and how it will be resolved?..

Answer / chandu

when we try to dml operation on orginal table in trigger.
then the trigger was excuted but while perfoming any action
on original table it will show mutating..

to overcome the above problem we need to create a autonamous
trasaction trigger..

Is This Answer Correct ?    9 Yes 1 No

When the mutating error will comes? and how it will be resolved?..

Answer / pravin more

Mutating error in Trigger:-
When programmer create trigger and give table name abc and
in body if programmer is using same table abc for
selecting,updating,deleting,inserting then mutation occur.
ex.:-
create or replace trigger xyz
after
update
on abc
for each row
referencing :OLD as OLD :NEW as NEW
begin
select max(salary) from abc;

update abc
set location_id=:NEW.location_id
where dept_id=105;

end;
------------------------------------------------------------
In the above example you are updating same table which is
under transaction so mutation problem occur here.

Solution on this is
You can use Temporary table or Materialize view which can
solve above problem

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

How can we implement rollback or commit statement in a trigger?

0 Answers  


i have a customer table. trans_id trans_date trans_amt debit_credit_indicator 001 01-JAN-13 1099 cr 001 12-JAN-13 500 db 002 24-FEB-13 400 db 002 23-MAR-13 345 cr 001 18-APR-13 800 cr 002 15-MAR-13 600 db 001 12-FEB-13 200 cr i want like this output. trans_id trans_amt debit_credit_indicator i want get highest credit amount and lowest credit amount and highest debit amount and lowest debit amount for each trans_id.

2 Answers   Oracle,


select * from emp where sal in(select max(sal) from emp) here there is any limit for in operator how many values accpect ?

2 Answers  


table :- city name country code abc 11 bcd 22 cde 232 def 33 write a procedure , so that when we give a phone no. eg - 1123456789 - o/p sud be city name = abc if phone no. - 2322345897 , o/p sud be =cde note - bcd and cde city name sud be diff. as dey diff only with th last no. Pls ans. this questnion.

1 Answers  


How do I remove sql developer from windows 10?

0 Answers  






What is posting?

0 Answers  


what is the difference between blob and text? : Sql dba

0 Answers  


Is pl sql better than sql?

0 Answers  


What is the criteria while applying index to any column on any table.

1 Answers   Infogain,


In a table only one column how to update rows

5 Answers   Microsoft,


How do you know if a relationship is 2nf?

0 Answers  


Why we use sql profiler?

0 Answers  


Categories