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
How does left join work in sql?
Is sql an operating system?
What sql database should I use?
Why is stored procedure faster than query?
How do I write a cron which will run a sql query and mail the results to agroup?
Why procedure is used in sql?
what are ddl statements in mysql? : Sql dba
Write a query to display the current date in sql?
Explain the purpose of %type and %rowtype data types?
How do you optimize a stored procedure query?
What type of database is sql?
Which sql statement is used to delete data from a database?
What is a trigger in sql?
Why select is used in sql?
What is the difference between row level and statement level trigger?