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
what is not null constraint? : Sql dba
How do you remove duplicate records from a table?
What is nvl?
Can we rollback after truncate?
Give the order of sql select?
What is difference between sql and excel?
how to select first 5 records from a table? : Sql dba
How many types of triggers exist in pl/sql?
What is the largest value that can be stored in a byte data field?
what are date and time data types in mysql? : Sql dba
What is trigger and types?
What is a dirty read sql?
What is t sql in sql server?
How to write a query to show the details of a student from students table whose
Is sql the best database?