Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

which will fire first ? Trigger or Constraint

Answer Posted / pradeep

TRigger fires fist, it dose not matter is it befor or
after, please see the below trigger. Even i am not entering
not a valid DEPTNO, still trigger fires first and then
constraint error comes


CREATE OR REPLACE TRIGGER EMPTRIGGER after INSERT ON EMP
FOR EACH ROW
BEGIN
--- RAISE_APPLICATION_ERROR(-20201,'INVALID NUMBER');
dbms_output.put_line(
'in triggeerssssssssssssssssssssssssssssssssssssssssss');
END;
SQL> /

Trigger created.

SQL> INSERT INTO EMP(EMPNO,DEPTNO) VALUES(3333,50);
in triggeerssssssssssssssssssssssssssssssssssssssssss
INSERT INTO EMP(EMPNO,DEPTNO) VALUES(3333,50)
*
ERROR at line 1:
ORA-02291: integrity constraint (SCOTT.FK_DEPTNO) violated -
parent key not
found

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is a primary key important?

965


Why triggers are used?

936


Which is better stored procedure or query?

918


Is join an inner join?

893


how to load data files into tables with 'mysqlimport'? : Sql dba

1031


What are the different dcl commands in sql?

1063


hi,i plan to put experience on PLSQL ,can anyone suggest me for any institutes in bangalore or how to prepare for interviews

1976


What is the difference between the sql*loader and import utilities? : aql loader

975


How much does a sql dba make? : SQL DBA

888


How to take user input in pl sql?

1105


What is the maximum number of columns in sql table?

1087


Write a query to find the names of users that begin with "um" in sql?

923


What is row_number () in sql?

929


what is meant by nl2br()? : Sql dba

973


why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba

1040