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 a parameter query?
What are the different types of functions in sql?
Does oracle use sql?
What is the difference between the repeatable read and serializable isolation levels? : Transact sql
what does the t-sql command ident_incr does? : Transact sql
What does subquery mean in sql?
Advantages and disadvantages of stored procedure?
What will you get by the cursor attribute sql%rowcount?
What is data types in sql?
Why do we use subquery?
How do I run sql?
What do you mean by table in sql?
What is a sql profiler?
Why are sql stored procedures used?
What is difference sql and mysql?