You can get the Oracle user with this statement:
select user from dual;
Main Topics
Browse All TopicsWe would like to capture the user, whenever there is change to table in Update,delete.
In our organization all user are using single Oracle user. We used trigger on table using USERENV(TERMINAL) but this does not solve our problem because it only give the terminal name and it is not designated for sigle user. In actual we want to capture the user id which he uses to log on to application.
I thank in advance for all your valueable comments and suggestion.
Ravi
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
if you create a user_name column or a user_id column and a modified_dt column on the table then you can collect history for free by setting the default values (when null is inserted) as follows:
user_name = USER
user_id = UID
modification_dt = SYSDATE
these should populate the columns for free each time a row is inserted.
when updating and/or deleting, you need a trigger to insert the data into a history archive table or manage the rows directly using the same reserved words.
randy
Hi everybody,
Thanks for the prompt comments,
The comments provided to question all are correct but it cannot be applied here to trap a user who is updating or deleting record, since we are using single oracle user and common WIN 2000 logon for user.
Only thru the forms or Application Menu each user have unique id to logon, these are table values. this is the user id, which we want to capture thru the table trigger.
Thanks once again.
ok, so from the Forms/Application Menu you know the user ... then set it as a package variable there!
use the following package:
create or replace package xxx as
function getuser return varchar2;
procedure setUser(usr in varchar2);
end;
/
create or replace package body xxx as
varuser varchar2(30);
function getuser return varchar2 is
begin
return varuser;
end;
procedure setUser(usr in varchar2) is
begin
varuser := usr;
end;
end;
/
Then in your Forms/Menu Application where you logon use the SetUser procedure to set the user, and in your trgger use the GetUser function!
Cheers,
Stefan
Business Accounts
Answer for Membership
by: stemu2000Posted on 2002-11-14 at 01:52:59ID: 7447338
select OSUSER from v$session where userenv('sessionid')=AUDSI D;
Cheers, Stefan