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 mutating trigger?

583


What is the difference between union and union all command?

555


what are properties of a transaction? : Sql dba

561


Is pl sql a scripting language?

590


What is a data manipulation language?

570






what is isam? : Sql dba

573


What is vector point function?

568


Does db2 use sql?

510


What does where 1 1 mean in sql?

547


What is varchar sql?

620


How many types of primary keys are there?

529


What are sql commands?

505


what are the types of join and explain each? : Sql dba

532


How exception handling is done in advance pl/sql?

499


What is the command used to fetch first 5 characters of the string?

885