How do I find my own session's serial# ?
How do I kill a list of processes, ensuring the executing session is not one of them?
I need both sid SID and SERIAL# and this is the only way I could think of getting them.
PL/SQL snippet:
select sys_context ('USERENV','SID'),sys_context('USERENV','SESSIONID') INTO env_sid, env_sessid FROM dual;
select serial$ from gv$session into env_serno where sid=env_sid and audsid=env_sessid;
I thought this would be OK, but after a couple weeks of using it the procedure, a user has complained that they received the "ORA-01422: exact fetch returns more than requested number of rows". I assume it was the second statement that produced the error. We can't reproduce it now.