which will fire first ? Trigger or Constraint

Answer Posted / vijay kumar s

Hi all,

leave th 9th answer ............

ignore 9 th answer....

see below one

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(101);
INSERT INTO T_CHK VALUES(101)
*
ERROR at line 1:
ORA-20011: VALUES SHOULD BE < 100
ORA-06512: at "SVR.CHKT", line 3
ORA-04088: error during execution of trigger 'SVR.CHKT'




Trigger will fire Before insert trigger only
then constraints
then after insert trigger

Is This Answer Correct ?    12 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is cross join sql?

679


Is primary key clustered index?

687


what is auto increment? : Sql dba

742


What is sql exception?

705


Explain what is a field in a database and record in a database?

790






What is before trigger?

735


What is data types in sql?

705


what is cross join? : Sql dba

742


What is the difference between microsoft access and sql server?

711


What is mutating sql table?

824


What is a schema sql?

743


How does pl sql work?

705


What is count * in sql?

747


what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql

700


What is difference between function and trigger?

719