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 fireeven 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.
D,
New and Old can be used only in row level triggers
D
D
D
D
D
NEW and OLD can be used only in row level triggers.
D
ORA-04082: NEW or OLD references not allowed in table level triggers
CREATE OR REPLACE TRIGGER trigger_name
BEFORE INSERT
ON table_name
[ FOR EACH ROW ]
DECLARE
BEGIN
EXCEPTION
END;
Within a Row trigger,
the PL/SQL and SQL statements can access
to the old and new column values of the current row affected by the triggering statement.
D
D
??
d
Excellent post. I certainly love this website. Thanks!
http://www.zeroplusfinance.com/how-to-properly-collect-gold-coins-to-achieve-the-maximum-profits/
Answer: D
set serveroutput on
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;
/
show errors
/*
Error report –
ORA-04082: NEW or OLD references not allowed in table level triggers
04082. 00000 – "NEW or OLD references not allowed in table level triggers"
*Cause: The trigger is accessing "new" or "old" values in a table trigger.
*Action: Remove any new or old references.
*/