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

How do I add a database to sql?

1124


What is a native sql query?

1063


What are sql*plus environment variables?

1093


what is the difference between myisam static and myisam dynamic? : Sql dba

1059


Are views faster than queries?

986


Can we use views in stored procedure?

1029


What are different functions in sql?

940


how to add a new column to an existing table in mysql? : Sql dba

1064


What are dml commands?

1020


How do I find duplicates in sql?

929


how many columns can be used for creating index? : Sql dba

944


How to use transactions efficiently : transact sql

1054


what are the differences among rownum, rank and dense_rank? : Sql dba

1036


what is the functionality of the function htmlentities? : Sql dba

951


Is sql injection illegal?

1015