This function returns the SID of the current session
Argument Name | Type | In/Out | Default? |
None |
For example:
SELECT dbms_support.mysid FROM dual;
If required, the result can be joined to V$SESSION to obtain the serial number e.g.:
SELECT sid, serial# FROM v$session WHERE sid = dbms_support.mysid;
The DBMS_SUPPORT.MYSID function actually executes the following query:
SELECT sid FROM v$mystat WHERE ROWNUM = 1;
In Oracle 8.1.5 and above the SID and serial# for the current session can also be obtained using:
SELECT sid, serial# FROM v$session WHERE audsid = SYS_CONTEXT ('USERENV','SESSIONID');
Prior to Oracle 8.1.5 the SID and serial# for the current session can be obtained using:
SELECT sid, serial# FROM v$session WHERE audsid = userenv ('SESSIONID');