When Insert Trigger is Disable:

SQL> Insert into Employee(name,roll,department) values('Tom',12123, 'Business');

ERROR at line 1:
ORA-02291: integrity constraint (FK_STUDENT_DEPARTMENT_NAME)
violated - parent key not found

No ORA-02067 error

SQL> select sysdate from dual;
SYSDATE
-------------------
2013-12-20 13:00:47

In the trigger, we could catch the exception for ORA-02055 and rollback but the problem is a trigger cannot contain a commit or rollback statement, however by using autonomous transaction we can overcome this limitation but it’s considered bad practice but it is possible.

Thought of the day!

“If you want happiness for an hour — take a nap.’
If you want happiness for a day — go fishing.
If you want happiness for a year-inherit a fortune.
If you want happiness for a lifetime-help someone else.”
Chinese Proverb

Tagged:

About The Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.