Both of these work, but are inefficient for repeated frequent use by
an application:

select sid from v$session where audsid= userenv('sessionid');
select sid from v$mystat where rownum = 1;

This is the most efficient:

select ksusenum from x$ksumysta where rownum = 1;

You need to be SYS or have built a view on this with privs from SYS.

--
Jeremiah Wilton
http://www.speakeasy.net/~jwilton

On Wed, 19 Dec 2001, Deshpande, Kirti wrote:

> Way much better :)
> Thanks. I forgot about mystat view..
>
> -----Original Message-----
> Sent: Wednesday, December 19, 2001 3:12 PM
> To: [EMAIL PROTECTED]
>
> select distinct SID from v$mystat;
>
> "Deshpande, Kirti" wrote:
> >
> >  select sid from v$session
> >  where audsid=(select userenv('sessionid') from dual);
> >
> > -----Original Message-----
> > Sent: Wednesday, December 19, 2001 1:36 PM
> > To: Multiple recipients of list ORACLE-L
> >
> > How do find own session id?

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jeremiah Wilton
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).

Reply via email to