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
explain normalization concept? : Sql dba
What is the difference between the sql*loader and import utilities? : aql loader
what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba
what is bcp? When does it used? : Sql dba
What is percent sign in sql?
What is nosql example?
What is a primary key sql?
what is the difference between delete and truncate statement in sql? : Sql dba
How can you get sql*loader to commit only at the end of the load file? : aql loader
how to use 'mysql' to run sql statements? : Sql dba
Does postgresql run on the cloud?
What is the max nvarchar size?
Why triggers are used?
What is sql in oracle?
What is plpgsql language?