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


Please Help Members By Posting Answers For Below Questions

What is a parameter query?

1017


What are the different types of functions in sql?

995


Does oracle use sql?

874


What is the difference between the repeatable read and serializable isolation levels? : Transact sql

1009


what does the t-sql command ident_incr does? : Transact sql

1009


What does subquery mean in sql?

986


Advantages and disadvantages of stored procedure?

1057


What will you get by the cursor attribute sql%rowcount?

970


What is data types in sql?

946


Why do we use subquery?

940


How do I run sql?

1092


What do you mean by table in sql?

936


What is a sql profiler?

958


Why are sql stored procedures used?

985


What is difference sql and mysql?

936