Oracle triggers when updating
After the T-SQL UPDATE command, we then execute a T-SQL SELECT query to make sure the trigger executed correctly.The output from the UPDATE and SELECT statements are shown below.We populate the table with three test records with the Order Approval Date Time set to NULL and the Order Status set to "Pending".In this example, we want our trigger to populate the Order Approval Date Time with the current date provided by the getdate() function after the Order Status is updated to "Approved".This events will alternates between BEFORE and AFTER row level triggers.4) Finally the AFTER statement level trigger fires.
It is very important to include the INNER JOIN to the INSERTED table so that only the updated rows are affected.
Notice above that only the first row had its Order Approval Date Time set to the current date, which is our desired behavior.
However, we need to run a second test to ensure that the correct number of rows have been updated.
The following hierarchy is followed when a trigger is fired. 2) Next BEFORE row level trigger fires, once for each row affected.
3) Then AFTER row level trigger fires once for each affected row.