106k views
1 vote
Suppose that a database modification results in the execution of a trigger but that trigger generates another modification that happens to violate a primary-key constraint. What happens?

User Agc
by
5.0k points

1 Answer

3 votes

Answer:

The database can detect only system-defined events.

Step-by-step explanation:

A trigger is like a stored procedure that Oracle Database invokes automatically whenever a specified event occurs.trigger is like a stored procedure that Oracle Database invokes automatically whenever a specified event occurs.

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

A constraint applies to both existing and new data. For example, if a database column has a NOT NULL constraint, then its existing data is NOT NULL and no DML statement can violate the NOT NULL constraint.

A trigger applies only to new data. 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

User Szybki
by
5.4k points