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

Can we declare a column having number data type and its scale is larger than pricesionex: column_name number(10,100),column_name numbaer(10,-84)

722


What is the use of & in pl sql?

723


what are date and time intervals? : Sql dba

759


How many functions are there in sql?

719


Is sql injection illegal?

770






Is sql the best database?

672


what is the difference difference between procedure and packages

9650


what is sql profiler? : Sql dba

793


What is sql engine in oracle?

721


Which is faster count (*) or count 1?

757


What is cursor in pl sql?

766


what is the difference between a having clause and a where clause? : Sql dba

692


how to extract a unit value from a date and time? : Sql dba

732


What does where 1 1 mean in sql?

746


Is sqlite good enough for production?

733