When the mutating error will comes? and how it will be
resolved?
Answers were Sorted based on User's Feedback
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 |
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 |
What are the types of triggers ?
26 Answers Aspire, BirlaSoft, TCS,
how to Update table Sales_summary with max(sales) data from table sales_dataTable 1. sales_data table Table 2. Sales_summary Region sales Region sales N 500 N 0 N 800 W 0 N 600 W 899 W 458 W 900 I want the Sales_summary After Update like this Region Sales N 800 W 900
explain the delete statements in sql
how to increment dates by 1 in mysql? : Sql dba
What is dense_rank?
Is left join inner or outer by default?
Is not equal in sql?
What is replication id?
What is sql mysql pl sql oracle?
What is the difference between null value, zero, and blank space?
What is integrity constraints?
Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints