Reputation: 159
I want to write a trigger which runs every time a user logs in and saves the name of each user, for example.
I have written trigger in this way:
create or replace TRIGGER LOGON_TRG
AFTER LOGON ON DATABASE
BEGIN
INSERT INTO t_log(ID,NAME) VALUES (S1.NextVal,ora_login_user);
END;
Does anyone have any solutions for this?
Upvotes: 3
Views: 1286
Reputation: 49062
Why implement a trigger when Oracle provides you AUDIT CONNECT
. It will record the login/logout activity into the audit trail.
You can have a look at Tom's suggestion here https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1830073957439
Upvotes: 4