which will fire first ? Trigger or Constraint
Answer Posted / pradeep
TRigger fires fist, it dose not matter is it befor or
after, please see the below trigger. Even i am not entering
not a valid DEPTNO, still trigger fires first and then
constraint error comes
CREATE OR REPLACE TRIGGER EMPTRIGGER after INSERT ON EMP
FOR EACH ROW
BEGIN
--- RAISE_APPLICATION_ERROR(-20201,'INVALID NUMBER');
dbms_output.put_line(
'in triggeerssssssssssssssssssssssssssssssssssssssssss');
END;
SQL> /
Trigger created.
SQL> INSERT INTO EMP(EMPNO,DEPTNO) VALUES(3333,50);
in triggeerssssssssssssssssssssssssssssssssssssssssss
INSERT INTO EMP(EMPNO,DEPTNO) VALUES(3333,50)
*
ERROR at line 1:
ORA-02291: integrity constraint (SCOTT.FK_DEPTNO) violated -
parent key not
found
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
how to create a new view in mysql? : Sql dba
What is the usage of the distinct keyword?
What is offset in sql query?
Describe different types of general function used in sql?
Why do we use set serveroutput on?
What is pl/sql language case sensitive?
What is the difference between sql and mysql?
What is pivot in sql?
What is the difference between left outer join and left join?
What are sql queries used for?
Which join is default?
What does count (*) mean in sql?
Explain the difference between rename and alias?
Which command is used to delete a trigger?
How long does it take to learn pl sql?