Log user's login and logout details in to table through Oracle Forms using POST-LOGON and PRE-LOGOUT triggers to track the user's login and logout activity for auditing purposes.
 
In this example one table and a sequence object is used to log the data in to table called login_out and the login information would be logged through Post-Logon trigger and logout information would be logged through Pre-Logout trigger in Oracle Forms. Follow the below mentioned steps to perform this task.

1. Create a Sequence object in Oracle Database.

CREATE SEQUENCE login_seq
   START WITH 1
   INCREMENT BY 1
   NOCACHE
/

2. Create a Table in Oracle Database.

CREATE TABLE login_out
(
   srlno     NUMBER (10) PRIMARY KEY,
   loguser   VARCHAR2 (20 BYTE),
   indate    DATE,
   outdate   DATE
)
/

3. Create a Post-Logon Trigger at Form Level in Main Form of Your Application.

DECLARE
   v_seq    NUMBER (10);
   v_user   VARCHAR2 (20) := GET_APPLICATION_PROPERTY (username);
BEGIN
 
   SELECT login_seq.NEXTVAL INTO v_seq FROM DUAL;
  
   /* this global variable is created to use on pre-logout trigger to update the correspondent record. */
   :Global.login_seq := v_seq;
  
   INSERT INTO login_out (srlno, loguser, indate)
       VALUES (v_seq, v_user, SYSDATE);
 
   COMMIT;
  
EXCEPTION
   WHEN OTHERS
   THEN
      RAISE form_trigger_failure;
END;

4. Create a Pre-Logout Trigger at Form Level in Main Form of Your Application.

DECLARE
   v_seq    NUMBER (10) := :GLOBAL.login_seq;
BEGIN
 
   Update login_out
      set outdate = SYSDATE
      where srlno = v_seq;
 
-- No need to commit here it will do automatically
 
EXCEPTION
   WHEN OTHERS
   THEN
      RAISE form_trigger_failure;
END;

Now run the form and after that you can check the login_out table to view the data as following:

SELECT *
  FROM login_out
WHERE TRUNC (indate) = TRUNC (SYSDATE)
/
Note: These triggers should added into Main Form only of your application, not in every form.

How to Log Users Login and Logout Details Through Oracle Forms的更多相关文章

  1. django(权限、认证)系统——用户Login,Logout

    上面两篇文章,讲述的Django的Authentication系统的核心模型对象User API和相关的使用,本文继续深入,讨论如何在Web中使用Authentication系统. 前面说了,Djan ...

  2. Login 和 Logout

    inux下Login和Logout详解                Login 是你用Linux系统工作时面对的第一个进程,这对于使用终端以及通过网络使用Linux都是正确的.但是login进程本身 ...

  3. Django 自带登录验证:authenticate和login,login_require,logout模块

    验证之前需要在settings 中指定验证数据models AUTH_USER_MODEL = 'crm.UserProfile'#app名字.表名字 1.authenticate是一个方法,验证账号 ...

  4. django 自带认证系统(login,logout,authenticate,login_required)

    from django.contrib.auth import login,authenticate,logoutfrom django.contrib.auth.decorators import ...

  5. Creating Custom Login Screen In Oracle Forms 10g

    Below is the example plsql unit to validate login credentials and after successful validation open a ...

  6. Hbase的几个关键问题(转自log.csdn.net/javastart/article/details/43772575)

    什么是HBase?何时用HBase?与Hive.Pig的区别?HBase的结构为何HBase速度很快?HBase常用的操作有哪些?HBase的一些配置和监控 什么是HBase? HBase,是Hado ...

  7. dataguard日志损坏处理

    ===== 问题 ===== 日志损坏无法应用日志(开启MRP应用系统会因无法应用日志而关闭) Completed: ALTER DATABASE RECOVER MANAGED STANDBY DA ...

  8. login/logout切换

    1. 前端按钮 <img border="0" width="18" height="18" src="<%=base ...

  9. FaceBook登陆API -- Login with API calls

    Login with API calls Related Topics Understanding sessions FBSession Error handling FBError FBLoginC ...

随机推荐

  1. asp.net实现调用ffmpeg实现视频格式的转换

    视频格式转换的函数 //视频转换 public void VideoConvertFlv(string FromName, string ExportName) { string ffmpeg = H ...

  2. sql server备份

    完全备份 declare @device varchar(255),@path varchar(255),@dbname varchar(255)set @dbname='MIS_TEMP'set @ ...

  3. 7、JavaScript 知识总结

    1.JavaScript的作用 ①JavaScript 为 HTML 设计师提供了一种编程工具 ②JavaScript 可以将动态的文本放入 HTML 页面 ③JavaScript 可以对事件作出响应 ...

  4. C# 引用访问权限

    同样代码表现的不同行为 创建基类(Super)和派生类(Sub)每个类有一个字段field和一个公共方法getField,并且使用内联的方式初始化为1,方法getField返回字段field.C#和J ...

  5. jmter+ANT+jekins之配置文件简单优化(build.xml)

    <?xml version="1.0" encoding="utf-8"?> <project name="ant-jmeter-t ...

  6. Leetcode 652.寻找重复的子树

    寻找重复的子树 给定一棵二叉树,返回所有重复的子树.对于同一类的重复子树,你只需要返回其中任意一棵的根结点即可. 两棵树重复是指它们具有相同的结构以及相同的结点值. 下面是两个重复的子树: 因此,你需 ...

  7. [转]Ubuntu下添加开机启动脚本

    作者: 王恒 发表于 2012年 11月 5日 1.方法一,编辑rc.loacl脚本 Ubuntu开机之后会执行/etc/rc.local文件中的脚本, 所以我们可以直接在/etc/rc.local中 ...

  8. mapserv和mapserv.exe的区别

    哎,困扰了我这么久才知道一个是在unix环境下的,一个是在windows环境下的

  9. 2017年浙江工业大学之江学院程序设计竞赛决赛 I: qwb VS 去污棒(可持久化Trie+离线)

    问题 I: qwb VS 去污棒 时间限制: 2 Sec  内存限制: 256 MB 提交: 74  解决: 26 [提交][状态][讨论版] 题目描述 qwb表白学姐失败后,郁郁寡欢,整天坐在太阳底 ...

  10. SPOJ COT2 - Count on a tree II(LCA+离散化+树上莫队)

    COT2 - Count on a tree II #tree You are given a tree with N nodes. The tree nodes are numbered from  ...