which will fire first ? Trigger or Constraint
Answer Posted / vijay kumar s
create table T_CHK (a number check (A < 99));
CREATE TRIGGER CHKT BEFORE INSERT ON T_CHK
FOR EACH ROW
BEGIN
IF :NEW.A >100 THEN
RAISE_APPLICATION_ERROR(-20011,'VALUES SHOULD BE < 100');
END IF;
END;
SQL> INSERT INTO T_CHK VALUES(100);
INSERT INTO T_CHK VALUES(100)
*
ERROR at line 1:
ORA-02290: check constraint (SVR.SYS_C00301152) violated
ABOVE ONE CLEARLY TELLS
contraints will fire first.
| Is This Answer Correct ? | 14 Yes | 7 No |
Post New Answer View All Answers
What is trigger explain it?
How can we connect an Android App to an Oracle database and use the PL/SQL procedural code?
Mention what does the hierarchical profiler does?
what are the different type of sql's statements ? : Sql dba
How do sql triggers work?
what are tables and fields? : Sql dba
How do you clear the screen in sql?
What is the difference between a procedure and a function?
Can a commit statement be executed as part of a trigger?
what is the use of friend function? : Sql dba
What is join view in sql?
What is lookup table in sql?
Is and as keyword in pl sql?
How global cursor can be declare with dynamic trigger ?
What is the use of procedures?