Answer Posted / purushottam
All the above suggested point is fine but addition on it is
when you are going to use the aggregate function for same
table then also be the mutating table error will occur.
example:
create table t(x numner);
/
create or replace trigger t_af_trigg
before insert into t
for each row
declare
n integer;
begin
select count(*) into n from t;
dbms_output.put_line('there are ' || n || ' rows in t');
end;
/
insert into t values(1);
error:
ORA-04091: table MISC.T is mutating, trigger/function may
not see it
ORA-06512: at "MISC.T_AF_TRIGG", line 5
ORA-04088: error during execution of trigger 'MISC.T_AF_TRIGG'
This example value addition of Vivek's suggession
"Mutating means that some one is trying to access the table
currently being held by some other non-committing
transaction(i.e. in Locked state)"
| Is This Answer Correct ? | 20 Yes | 9 No |
Post New Answer View All Answers
What is faster join or subquery?
What is before trigger?
Explain the commit statement.
how can we find the number of rows in a table using mysql? : Sql dba
Define the select into statement.
Does a join table need a primary key?
Is id a reserved word in sql?
What is difference between inner join and cross join?
What is sql injection vulnerability?
what is the difference between undefined value and null value? : Sql dba
Can we update views in sql?
Explain lock escalation? : Transact sql
Can I learn sql in a week?
what is the different between now() and current_date()? : Sql dba
what are string data types? : Sql dba