日期:2014-05-17 浏览次数:20867 次
create or replace trigger logoff_trigger
before logoff on database
begin
update stats$user_log
set last_module =
(select module
from v$session
where sys_context('USERENV', 'SESSIONID') = audsid)
where sys_context('USERENV', 'SESSIONID') = session_id;
update stats$user_log
set logoff_day = sysdate
where sys_context('USERENV', 'SESSIONID') = session_id;
update stats$user_log
set logoff_time = to_char(sysdate, 'hh24:mi:ss')
where sys_context('USERENV', 'SESSIONID') = session_id;
update stats$user_log
set elapsed_minutes = round((logoff_day - logon_day) * 1440)
where sys_context('USERENV', 'SESSIONID') = session_id;
end;