View the Exhibit and examine the structure of the customer table.
Examine the following trigger code:
What is the outcome when the above trigger is compiled?
A. It compiles successfully.
B. It gives an error because the when condition is not valid.
C. It gives an error because when cannot be used for row-level triggers.
D. It gives an error because the statements under updating are not valid.
E. It gives an error because the new qualifier in the when clause requires a colon prefix.
Code compiled for me in HR schema for employees table.
So I think answer A is correct.
CREATE OR REPLACE TRIGGER max_credit_limit
BEFORE INSERT OR UPDATE OF MANAGER_ID ON EMPLOYEES
FOR EACH ROW
WHEN (NEW.MANAGER_ID IS NULL)
BEGIN
IF INSERTING THEN
:NEW.MANAGER_ID := 100;
:NEW.SALARY := 8000;
ELSIF UPDATING THEN
:NEW.MANAGER_ID := :OLD.MANAGER_ID;
:NEW.SALARY := :OLD.SALARY;
END IF;
END;
/