how instead of triger is helpful for mutating tables errors
handlling ?
Answers were Sorted based on User's Feedback
Answer / guru
"Mutating" means "changing". A mutating table is a table
that is currently being modified by an update, delete, or
insert
statement. When a trigger tries to reference a table that is
in state of flux (being changed), it is considered
"mutating" and
raises an error since Oracle should not return data that has
not yet reached its final state.
Another way this error can occur is if the trigger has
statements to change the primary, foreign or unique key
columns of the
table off which it fires. If you must have triggers on
tables that have referential constraints, the workaround is
to enforce the
referential integrity through triggers as well.
There are several restrictions in Oracle regarding triggers:
• A row-level trigger cannot query or modify a
mutating table. (Of course, NEW and OLD still can be
accessed by the
trigger) .
• A statement-level trigger cannot query or modify a
mutating table if the trigger is fired as the result of a
CASCADE delete.
So some time we can not use triggers to put DMl operations
on table. that time we can use INSTEAD OF TRIGGER.
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / mahesh
create a view (simple view) on mutating table
write a tigger on view (define similar to table)
Know try to do dml operations on table
it will not show the mutating error
Is This Answer Correct ? | 2 Yes | 2 No |
What are the ways on commenting in a pl/sql code?
What is a scalar value in sql?
What is user defined functions?
What are the different types of sql commands?
How do you determine the current isolation level? : Transact sql
What is meant by user defined function?
How do I view tables in sql developer?
What type of join is sql join?
What are Nested Tables? How will u delete 5 rows from Nested Tables
what are the advantages and disadvantages of views in a database? : Sql dba
A table has 150 records. How do you retrieve 100th row to 120th row from that table ?
What is 19 null in sql?