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 nosql db?
What does closing a cursor do?
When sql appeared?
What are keys in sql?
What is difference between mysql and postgresql?
What is the most restrictive isolation level? : Transact sql
Why use truncate instead of delete?
what is unique key constraint? : Sql dba
What do you understand by pl/sql records?
How many types of cursors supported in pl/sql?
What are different types of sql commands?
How do I count records in sql?
Define commit?
What is before trigger?
discuss about myisam key cache. : Sql dba