How to Log Users Login and Logout Details Through Oracle Forms

Source: Internet
Author: User
Tags one table

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 are used to logs the data in to table called Login_out and the login Informa tion would be logged through Post-logon trigger and logout information would being logged through Pre-logout trigger in Oracl E 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 (Ten) PRIMARY KEY, LogUser VARCHAR2 (BYTE), Indate DATE, Outd Ate DATE)
/3. Create a Post-logon Trigger at the form level in Main form of Your application. DECLARE    v_seq    Number (10);    v_user   VARCHAR2: = Get_application_property (username); BEGIN      SELECT login_seq. Nextval to V_seq from DUAL;      /* This global variable are created to use on Pre-logout trigger to update the correspondent Reco Rd. */  : 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 the form level in Main form of Your application. DECLARE    v_seq    Number (Ten): =: global.login_seq; BEGIN      Update login_out       Set outdate = Sysdate       where srlno = V_seq;  --No need to commits here it'll do automatically   EXCEPTION    when OTHERS    then &nbs p;     RAISE form_trigger_failure; END;

Now run the form and after so 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 the your application, not in every form.

How to Log Users Login and Logout Details Through Oracle Forms

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.