Oracle pl sql trigger updating

I have found this to be especially helpful when I or others have to troubleshoot the consequences of user data corruption as it relates to triggers being fired - the less triggers you have to try to piece together the logic for, the easier it is to see how data was manipulated. Obviously the separate triggers are more efficient because you're doing fewer logical checks, but you have a decent point on the benefit of having fewer triggers.

The CREATE TRIGGER statement has a lot of permutations, but the vast majority of the questions I'm asked relate to basic DML triggers.

I basically have a tree, each member of that tree has a root_ID pointing at the unique ID of the root and a parent ID pointing at the one above it.

The root's root and parent IDs are its own unique ID.

It does not "see" the new record because the record has not been committed so the update comes back with 0 rows updated.

We can create a trigger to update the 'product_price_history' table when the price of the product is updated in the 'product' table.

I want the ROOT_ID to propagate down the tree I've built.

Edit: How this works is that each record has a unique ID, a parent ID, and a root ID.

The order of the execution of these triggers is undeterministic (or random, if you want this word) except that all before triggers fire before the after triggers.

CREATE OR REPLACE TRIGGER ROOT_CHANGING_TRG BEFORE UPDATE OF ROOT_ID, PARENT_PHYS_ID ON UNIQUE_PHYSICIAN FOR EACH ROW DECLARE var_root number := :new. UNIQUE_ID; BEGIN UPDATE UNIQUE_PHYSICIAN SET ROOT_ID = var_root WHERE PARENT_PHYS_ID = var_par; END; Will this trigger propagate?

Search for oracle pl sql trigger updating:

oracle pl sql trigger updating-19oracle pl sql trigger updating-49

The actions that I need to do on my -- Scenario 1 CREATE OR REPLACE TRIGGER my_trg BEFORE INSERT OR UPDATE ON my_table FOR EACH ROW BEGIN IF UPDATING THEN IF : NEW.my_col IS NULL THEN raise_application_error(...); END IF; IF : NEW.my_col2 IS NULL THEN : NEW.my_col2 := (...); END IF; END IF; IF INSERTING THEN IF : NEW.my_col3 IS NULL THEN SELECT my_seq.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “oracle pl sql trigger updating”