Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: WHICH SID

Re: WHICH SID

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Wed, 19 Dec 2001 15:21:46 -0800
Message-ID: <F001.003E0C35.20011219150022@fatcity.com>

Jeremiah Wilton wrote:
>
> 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
>

If you really want to use it frequently, the best of all solutions, which doesn't require any special privilege, is probably to store it into a packaged variable, and to assign the proper value in the initialisation section of the package. Here, how circumvoluted your way of coding the query, efficiency will not matter too much.

-- 
Regards,

Stephane Faroult
Oriole Ltd
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriole.com

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: 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 Wed Dec 19 2001 - 17:21:46 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US