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

explain normalization concept? : Sql dba

571


What is the difference between the sql*loader and import utilities? : aql loader

589


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

560


what is bcp? When does it used? : Sql dba

511


What is percent sign in sql?

704






What is nosql example?

572


What is a primary key sql?

548


what is the difference between delete and truncate statement in sql? : Sql dba

535


How can you get sql*loader to commit only at the end of the load file? : aql loader

539


how to use 'mysql' to run sql statements? : Sql dba

527


Does postgresql run on the cloud?

577


What is the max nvarchar size?

502


Why triggers are used?

545


What is sql in oracle?

609


What is plpgsql language?

515