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 create index on primary key?

497


What is lookup table in sql?

586


How do I partition a table in sql?

514


What are the different types of tables in sql?

459


How to sort the rows in sql.

576






Can I learn sql in a week?

515


What are the basic techniques of indexing?

543


Why join is faster than subquery?

571


Write a sql query to get the third highest salary of an employee from employee_table?

608


Explain locks? : Transact sql

541


What is sql integrity?

557


What are the methods of filing?

498


What's the procedure?

471


Table A Table B 1 1 2 1 3 1. Union & union all --> A Union B , A Union all B 2. Minus , Intersect --> A minus B , B Minus A , A Intersect B 3. Joins A join B , A Left Join B A Right Join B , A full Join B 4. %Type - Uses & Benifit 5. Truncate & Delete 6. Pragma Autonomus Transaction 7. how to Perform DDL from function or procedure 8. Can we have DML inside Function 9. Rank & Dense Rank diffrence 10. Water Mark in Oracle 11. Index , Can we have index in all column of table if no then why ?

514


What is use of term?

596