You want to maintain an audit of the date and time when each user of the database logs off.
Examine the following code:
Which two clauses should be used to fill in the blanks and complete the above code?
(Choose two.)
A. ON SCHEMA
B. ON QRXABASE
C. AFTER LOGOFF
D. BEFORE LOGOFF
Looks like correct answer is B and D.
But QRXABASE looks like typo. It should be DATABASE instead.
So following code worked for me:
sqlplus system
create table log_trig_table(
user_id varchar2(30),
log_date timestamp,
action varchar2(40));
create or replace trigger logoff_trig
before logoff
on database
begin
insert into log_trig_table(user_id,log_date,action)
values (user,sysdate,’Logging off’);
end;
/
exit
sqlplus system
SQL> select * from log_trig_table;
USER_ID
——————————
LOG_DATE
—————————————————————————
ACTION
—————————————-
SYSTEM
19-JUN-19 04.09.00.000000 PM
Logging off