I have a field in a table called LAST_USER_ID. I want to populate it with the oracle id/username of the person who creates or updates a record. Is there a reserved constant that stores the id value. How can I get it?
There is a function, userenv, that can be used to get the current session id. You can use it to get the Oracle username from v$session. The query would be
select username from v$session
where audsid = (select userenv('sessionid') from dual)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.