which will fire first ? Trigger or Constraint
Answer Posted / radha sri seshu.kolla
NOW I AM 100% SURE THAT TRIGGER WILL FIRE FIRST.
TRY THIS CODE YOU WILL UNDERSTAND
------------------------------------------------------------
CREATE OR REPLACE TRIGGER EMPTRIGGER BEFORE INSERT ON EMP
FOR EACH ROW
BEGIN
FOR I IN (SELECT EMPNO FROM EMP)
LOOP
IF I.EMPNO=:NEW.EMPNO THEN
RAISE_APPLICATION_ERROR(-20201,'INVALID NUMBER');
END IF;
END LOOP;
END;
/
INSERT INTO EMP(EMPNO,DEPTNO) VALUES(7788,10)
---------------------------------------------------------
FEEL FREE TO TALK WITH ME ON 9966409914. IF NOT RINGING
THEN TRY 9966112520
| Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
Explain two easy sql optimizations.
What are the basic techniques of indexing?
what is an alias command? : Sql dba
How do you write a complex sql query?
How do I trace sql profiler?
Explain normalization and what are the advantages of it?
what is the difference between truncate and delete statement? : Transact sql
what are enums used for in mysql? : Sql dba
What is an index? What are the types of indexes? How many clustered indexes can be created on a table?
Is it possible to remove child records without removing master table records...the two having pk,fk relationship?
Write an sql query to select all records from the table?
Name some usages of database trigger?
What are few of the schema objects that are created using PL/SQL?
How can you tell the difference between an index and a view?
How do you write a subquery?