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


Please Help Members By Posting Answers For Below Questions

What are the two types of exceptions in pl/sql?

539


What is sql partition function?

610


When is the update_statistics command used?

568


What are literals in sql server?

524


what is a record in a database ? : Sql dba

566






What is sql and db2?

531


Why sql query is slow?

576


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...

1908


What are the differences between in and exists clause?

560


Which sql most popular?

546


what is the difference between sql and t-sql? : Transact sql

593


Mention what are different methods to trace the pl/sql code?

554


How do I count rows in sql query?

487


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..

2002


How to select unique records from a table?

565