Referencing Option and Conditional Predicates Assignment Help

Assignment Help: >> Creating Triggers - Referencing Option and Conditional Predicates

Using Referencing Option:

The Referencing option can be particular in a trigger body of a row trigger to prevent name conflicts between the correlation names and tables which may be named.

Using Conditional Predicates:

If more than one category of DML operation can fire a trigger, all the operations can be placed inside a single trigger each differentiated through what are known as conditional predicates.

For referring to Insert operation an INSERTING option is used, for Delete operation, an DELETING option is used and for update operation, an UPDATING is used predicates are used.  These are Boolean values which return TRUE only when the statement that fired a trigger is any one of DML statements. The syntax is as follows:

IF INSERTING THEN.....

ELSIF UPDATING THEN .....

ELSIF DELETING THEN .....

END IF;

Example

CREATE OR REPLACE TRIGGER prd_trig AFTER INSERT OR UPDATE OR DELETE ON product

BEGIN

IF INSERTING THEN

DBMS_OUTPUT.PUT_LINE('Inserting operation');

ELSIF UPDATING THEN

DBMS_OUTPUT.PUT_LINE('Updating operation');

ELSIF DELETING THEN

DBMS_OUTPUT.PUT_LINE('Deleting operation');

END;

END IF;

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd