What is the outcome when the above trigger is compiled?

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?

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.



Leave a Reply 18

Your email address will not be published. Required fields are marked *


Tr

Tr

E

Errors: check compiler log
Error(3,6): PLS-00049: bad bind variable ‘NEW.CUS_CATEGORY’

alex

alex

It’s A

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;

TRIGGER MAX_CREDIT_LIMIT compiled

sravanthi

sravanthi

Its A.

TRIGGER max_credit_limit compiled.

User

User

CREATE TABLE customer
(
cust_id number not null,
cust_last_name varchar2 (30) not null,
cust_city varchar2 (30) not null,
cust_credit_limit number,
cust_category varchar2 (30)
);
/
Create table EMPLOYEES
(MANAGER_ID number,
SALARY number);

/

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;

User

User

Trigger MAX_CREDIT_LIMIT compiled

Jen

Jen

B and D are incorrect.

If

FOR EACH ROW WHEN (:NEW.MANAGER_ID IS NULL)

then

ORA-25000: invalid use of bind variable in trigger WHEN clause

SK

SK

option C is wrong, when can not be sed in Stmt triggers
A is the right answer,

user1

user1

questions on website are correct, answers are wrong, make sure to go through the code and run it, just passed with a 95

prophet

prophet

WHEN (condition)

Specifies a SQL condition that the database evaluates for each row that the triggering statement affects. If the value of condition is TRUE for an affected row, then trigger_body runs for that row; otherwise, trigger_body does not run for that row. The triggering statement runs regardless of the value of condition.

The condition can contain correlation names (see “referencing_clause ::=”). In condition, do not put a colon (:) before the correlation name NEW, OLD, or PARENT (in this context, it is not a placeholder for a bind variable).