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
How does cross join work?
How exception is different from error?
Can we use having without group by in sql?
Which sql statement is used to delete data from a database?
What if we write return in procedure?
What is the difference between instead of trigger and after trigger?
How to start the command-line sql*plus?
What is the reports view in oracle sql developer?
How can we find duplicate records in a table?
Are there any features that are decommissioned in 11g that are not present in 11g?
What is data control language (dcl)?
Can I copy :old and :new pseudo-records in/to an oracle stored procedure?
what is a unique key ? : Sql dba
Does pl/sql support create command?
Why are indexes and views important to an organization?