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: [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).