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. 【Palindrome Number】cpp

    题目: Determine whether an integer is a palindrome. Do this without extra space. click to show spoiler ...

  2. Selenium-java 中 对于下拉框 对于网页上的下拉框 如何定位

    WebElement e1 = driver.findElement(By.cssSelector("#s_province")); Select se1 = new Select ...

  3. WPF TextBlock 调整下划线与文字的距离

    <TextBlock Foreground="> <TextBlock.TextDecorations> <TextDecorationCollection&g ...

  4. 04 JVM是如何执行方法调用的(下)

    虚方法调用 Java 里所有非私有实例方法调用都会被编译成 invokevirtual 指令,而接口方法调用会被编译成 invokeinterface 指令.这两种指令,均属于 Java 虚拟机中的虚 ...

  5. 利用python爬取58同城简历数据

    利用python爬取58同城简历数据 利用python爬取58同城简历数据 最近接到一个工作,需要获取58同城上面的简历信息(http://gz.58.com/qzyewu/).最开始想到是用pyth ...

  6. jsp运行机制

    一.JSP机制概述 可以把执行JSP页面的执行分成两个阶段,一个是转译阶段,一个是请求阶段. 转译阶段:JSP页面转换成Servlet类. 请求阶段:Servlet类执行,将响应结果发送至客户端. 1 ...

  7. redis应用场景及实例

    Redis在很多方面与其他数据库解决方案不同:它使用内存提供主存储支持,而仅使用硬盘做持久性的存储;它的数据模型非常独特,用的是单线程.另一个大区别在于,你可以在开发环境中使用Redis的功能,但却不 ...

  8. HDFS设计思想

    HDFS设计思想 DataNode:用来在磁盘上存储数据 HDFS  数据存储单元( block ) 1 文件被切分成固定大小的数据block块 •默认数据块大小为 64MB(hadoop1.x版本6 ...

  9. java简易DVD影片管理系统—面向对象

    public class DvdSet { String name [] =new String[15]; // DVD电影名称 String date [] =new String[15]; //D ...

  10. 【HDU 1686 Oulipo】

    Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission( ...