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 not null constraint? : Sql dba

551


How do you remove duplicate records from a table?

511


What is nvl?

615


Can we rollback after truncate?

565


Give the order of sql select?

614






What is difference between sql and excel?

516


how to select first 5 records from a table? : Sql dba

509


How many types of triggers exist in pl/sql?

569


What is the largest value that can be stored in a byte data field?

521


what are date and time data types in mysql? : Sql dba

504


What is trigger and types?

566


What is a dirty read sql?

487


What is t sql in sql server?

572


How to write a query to show the details of a student from students table whose

542


Is sql the best database?

503