View the Exhibit and examine the structure of the customer table.
You need to create a trigger to ensure that customers in category “A” and “B” have a credit limit of more than 8000.
Examine the following trigger.
Which statement is correct about the outcome of this trigger?
A. It compiles successfully and fires whenever the specified condition is met.
B. It compiles successfully but does not fire even when the condition is met
C. It gives an error on compilation because the new qualifier is prefixed with a colon.
D. It gives an error on compilation because the new qualifier can be used only in row-level triggers.
Correct answer is D.
It can be verified using following code:
SQL> create or replace trigger verify_cust_category
before insert on customer
begin
if :new.cust_category in (‘A’,’B’) and :new.cust_credit_limit<8000 then
raise_application_error(-20202,'Credit Limit cannot be less than 8000');
end if;
end;
/
create or replace trigger verify_cust_category
*
ERROR at line 1:
ORA-04082: NEW or OLD references not allowed in table level triggers