What type of trigger is it?

Examine this code:
CREATE OR REPLACE TRIGGER secure_emp
BEFORE LOGON ON employees
BEGIN
IF (TO_CHAR(SYSDATE, ‘DY’) IN (‘SAT’, ‘SUN’)) OR
(TO_CHAR(SYSDATE, ‘HH24:MI’)
NOT BETWEEN ’08:00′ AND ’18:00′)
THEN RAISE_APPLICATION_ERROR (-20500, ‘You may
insert into the EMPLOYEES table only during
business hours.’);
END IF;
END;
/
What type of trigger is it?

Examine this code:
CREATE OR REPLACE TRIGGER secure_emp
BEFORE LOGON ON employees
BEGIN
IF (TO_CHAR(SYSDATE, ‘DY’) IN (‘SAT’, ‘SUN’)) OR
(TO_CHAR(SYSDATE, ‘HH24:MI’)
NOT BETWEEN ’08:00′ AND ’18:00′)
THEN RAISE_APPLICATION_ERROR (-20500, ‘You may
insert into the EMPLOYEES table only during
business hours.’);
END IF;
END;
/
What type of trigger is it?

A.
DML trigger

B.
INSTEAD OF trigger

C.
Application trigger

D.
System event trigger

E.
This is an invalid trigger.

Explanation:
The Triggering Event is incorrect. A User does not LOGON or LOGOFF from a Table. You can’t create a BEFORE LOGON or AFTER LOGOFF trigger.
Event When allowed or applicable

STARTUP AFTER

SHUTDOWN BEFORE

SERVERERROR AFTER

LOGON AFTER

LOGOFF BEFORE

A: This trigger is not performing an INSERT, UPDATE or DELETE on Table B: INSETED OF Triggers are defined on a VIEW
C: Application triggers fire when a particular event occurs in the application. Application triggers
are developed using Oracle client-side tools, such as Oracle Forms Developer. E: This is a failed attempt of creating a System Event Triiger. Modify the code to specify AFTER LOGON ON DATABASE to correct the problem .



Leave a Reply 1

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


Leo Yu

Leo Yu

BEFORE LOGON ON employees -> BEFORE LOGON ON hr.schema