top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are constraining triggers in Oracle?

+1 vote
555 views
What are constraining triggers in Oracle?
posted Dec 12, 2014 by Archana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In Oracle triggers that run implicitly when an INSERT, UPDATE, or DELETE statement is issued against the associated table or, in some cases, against a view, or when database system actions occur. These procedures can be written in PL/SQL or Java and stored in the database, or they can be written as C callouts.

Both triggers and constraints can constrain data input, but they differ significantly.

A trigger always applies to new data only. For example, a trigger can prevent a DML statement from inserting a NULL value into a database column, but the column might contain NULL values that were inserted into the column before the trigger was defined or while the trigger was disabled.

Constraints are easier to write and less error-prone than triggers that enforce the same rules. However, triggers can enforce some complex business rules that constraints cannot. Oracle strongly recommends that you use triggers to constrain data input only in these situations:

1) To enforce referential integrity when child and parent tables are on different nodes of a distributed database

2) To enforce complex business or referential integrity rules that you cannot define with constraints

answer Dec 12, 2014 by Kali Mishra
...