You have a row level BEFORE UPDATE trigger on the EMP table. This trigger contains a SELECT statement on the EMP table to ensure that the new salary value falls within the minimum and maximum salary for a given job title.
What happens when you try to update a salary value in the EMP table?
A.
The trigger fires successfully.
B.
The trigger fails because it needs to be a row level AFTER UPDATE trigger.
C.
The trigger fails because a SELECT statement on the table being updated is not allowed.
D.
The trigger fails because you cannot use the minimum and maximum functions in a BEFORE UPDATE trigger.
Explanation:
This will result in a mutating table. A mutating table is a table against which a data manipulation statement has been issued and the corresponding trigger on the DML statement is reading from the same table, at the same time. To work around this you would need to need to create a statement level trigger with the SELECT statement and place the values into the package variables. Then the ROW Level Trigger could check the values in the package variables.
Incorrect AnswersA: This trigger would result in a mutating table and would generate an error. B: ROW level Triggers result in a mutating table, STATEMENT level triggers do not. D: You may use a MINIMUM and MAXIMUM Functions but not in a ROW level Trigger that queries the same table in which a DML operation is being performed.
I know this rule: only statement level trigger can select the row in the table which would be manipulated after the trigger,the thing is: why oracle has the rule? I didn’t see any reason why oracle has the rule.For the row level trigger before the manipulation, select would return old value, doesn’t it?