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
What are the two types of exceptions in pl/sql?
What is sql partition function?
When is the update_statistics command used?
What are literals in sql server?
what is a record in a database ? : Sql dba
What is sql and db2?
Why sql query is slow?
1. is it possible to use the cursor atttibutes (%found ,% rowcount , %isopen , %notfound ) to our user defined cursor names ....... cursor cursor_name is select * from scott.emp if you use... cursor_name%found , %rowcount ,%isopen,%notfound...will it work... -------------------------- 2.what is the difference between the varray and index by table .. -------- 3. type type_name is table of number(8,3) index by binary_integer; identifier_name type_name; first , last , prior , next ,trim are the methods we can use it for the above type...simillary is there any way to apply for cursors... with thanks and regards..sarao...
What are the differences between in and exists clause?
Which sql most popular?
what is the difference between sql and t-sql? : Transact sql
Mention what are different methods to trace the pl/sql code?
How do I count rows in sql query?
ERROR:Insert or update on table"accnt" violates foreign key constraints "acct_to_curr_symbol" DETAILS:KEY(accnt_curr_id)(-2)is not present in the table "curr_symbol" ......solve The Problem..
How to select unique records from a table?