René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Finding the current session's ID | ||
select sid, serial# from v$session where audsid = sys_context('userenv','sessionid');
Or, if you're only interested in the sid, not in serial#:
select distinct sid from v$mystat;
Note, the selected sid has nothing to do with the System Identifier.
If dbms_support is
installed, the current sid can also be found with its
mysid
function:
select dbms_support.mysid from dual;
Thanks to Jan Arnoldus who pointed out an error on this page!
|