What is mutating table?

Answer Posted / rami reddy

CREATE TABLE STUDENT(SNO NUMBER(4),SNAME VARCHAR2(20),COURSE VARCHAR2(20));
ANOTHER TABLE
CREATE TABLE NEW_STUDENT(SNO NUMBER(4),SNAME VARCHAR2(20));
NOW WECAN CREATE TRIGGER FOR AUTO_INSERT FROM TABLE STUDENT TO NEW_STUDENT.AT THAT WE CAN USE 'AFTER INERT' AND 'SELECT' IN THAT TRIGGER, AT THAT WE GET THIS TYPE OF ERROR

1 CREATE OR REPLACE TRIGGER ATUO_INSERT1
2 AFTER INSERT ON STUDENT
3 FOR EACH ROW
4 BEGIN
5 INSERT INTO NEW_STUDENT
6 SELECT :NEW.SNO,:NEW.SNAME FROM STUDENT;
7* END AUTO_INSERT1;
SQL> /

Trigger created.

SQL> INSERT INTO STUDENT VALUES(120,'RAJ','ORACLE');
INSERT INTO STUDENT VALUES(120,'RAJ','ORACLE')
*
ERROR at line 1:
ORA-04091: table SCOTT.STUDENT is mutating, trigger/function may not see it
ORA-06512: at "SCOTT.ATUO_INSERT1", line 2
ORA-04088: error during execution of trigger 'SCOTT.ATUO_INSERT1'

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does cross join work?

504


How exception is different from error?

545


Can we use having without group by in sql?

554


Which sql statement is used to delete data from a database?

467


What if we write return in procedure?

788






What is the difference between instead of trigger and after trigger?

514


How to start the command-line sql*plus?

566


What is the reports view in oracle sql developer?

545


How can we find duplicate records in a table?

514


Are there any features that are decommissioned in 11g that are not present in 11g?

1595


What is data control language (dcl)?

601


Can I copy :old and :new pseudo-records in/to an oracle stored procedure?

666


what is a unique key ? : Sql dba

547


Does pl/sql support create command?

578


Why are indexes and views important to an organization?

528