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


Please Help Members By Posting Answers For Below Questions

What is nosql db?

711


What does closing a cursor do?

985


When sql appeared?

815


What are keys in sql?

727


What is difference between mysql and postgresql?

705






What is the most restrictive isolation level? : Transact sql

768


Why use truncate instead of delete?

720


what is unique key constraint? : Sql dba

742


What do you understand by pl/sql records?

721


How many types of cursors supported in pl/sql?

794


What are different types of sql commands?

698


How do I count records in sql?

731


Define commit?

747


What is before trigger?

735


discuss about myisam key cache. : Sql dba

763