Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Finding SID of current session
Universal, and works with 7.3.4 - which is still in common use - but is deprecated in favour of:
select sid from v$session where audsid = sys_context('USERENV', 'SESSIONID' );
which still doesn't help if you have several SYS sessions running, as the sessionID for SYS is always zero.
The v$mystat option is the newer 'universal' except there is a preferred call to dbms_support.mysid (on the platforms which have, and have installed, dbms_support (dbmssupp.sql) - and the package only does a
select sid from v$mystat where rownum = 1; anyway.
Regards
Jonathan Lewis
http://www.jlcomp.demon.co.uk
The educated person is not the person who can answer the questions, but the person who can question the answers -- T. Schick Jr
One-day tutorials:
http://www.jlcomp.demon.co.uk/tutorial.html
Three-day seminar:
see http://www.jlcomp.demon.co.uk/seminar.html
____UK___November
The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html
I believe
select sid from v$session where audsid = USERENV( 'SESSIONID' );
is a universal way to determine one's current internal SID based on the sessionid returned by userenv.
Adam
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Jonathan Lewis
INET: jonathan_at_jlcomp.demon.co.uk
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Dec 02 2003 - 14:39:26 CST