Solved

Get os user name inside row level trigger

Posted on 2008-10-16
3
1,448 Views
Last Modified: 2013-12-18
Hi,

I have a trigger on a table and I want to capture the os user who updates a field in that table. How can I do that on a row level trigger?
0
Comment
Question by:PopoDi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 300 total points
ID: 22737363

Try:

SELECT SYS_CONTEXT ('USERENV', 'OS_USER') INTO OSUSER FROM DUAL;

Open in new window

0
 
LVL 27

Assisted Solution

by:sujith80
sujith80 earned 200 total points
ID: 22737400
The following code can get you the username in cases where the database connection is made directly through a client tool. But if your application web based/uses a connection pool or something like that; then this query will return the os user that has started the respective service.

declare
 l_usr varchar2(20);
begin
 l_usr := sys_context('userenv', 'os_user');
 dbms_output.put_line(l_usr);
end;
/

Bottom line: If the idea is to track the application users who has made the changes; you must use more complex techniques like the supplied package dbms_application_info.
0
 

Author Closing Comment

by:PopoDi
ID: 31506950
Thank you guys, I wish I could give 500 to each, but I split them based on the order they came in.
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question