Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Session ID
select * from v$session where audsid = userenv( 'SESSIONID' )
will get you the record from v$session for your currently logged in session.
On Tue, 11 Nov 1997 16:05:56 +0000, Pepe Galindo <ppgg_at_lcc.uma.es> wrote:
>Hello people!
>
>I have some questions. I hope somebody answer me. I will be grateful if he
>answerd me by e-mail too. Thanks.
>
>1. What number/s identify a Oracle session.
>2. How can a normal user (not dba) know that numbers?
> If it is impossible then:
> How can I construct a PL/SQL procedure to do that?
>
>I think that to identify a session are necessary 2 numbers: SID and
>SERIAL# from table V$SESSION.
>
>How can a user know that numbers?
>V$SESSION is a dba table. Then I can construct a PL/SQL procedure with SYS
>as owner:
>
>PROCEDURE SESSIONID (SID OUT NUMBER,
> SERIAL# OUT NUMBER) IS
> Usuario ALL_TABLES.OWNER%TYPE;
>BEGIN
> SELECT USER INTO Usuario FROM DUAL;
> SELECT SID,SERIAL# INTO SID,SERIAL# FROM V$SESSION
> WHERE USERNAME=Usuario AND STATUS='ACTIVE';
>END SESSIONID;
>
>One problem arise when exist two 'ACTIVE' sessions with the same USERNAME.
>Then the oracle error is:
>ORA-01422: exact fetch returns more than requested number of rows
>
>How can I access to V$SESSION table to read this two values for a only one
>session??
>
>The last question: Do somebody know a oracle news in spanish language?
>
>Thank you very much.
>ppgg_at_lcc.uma.es
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Tue Nov 11 1997 - 00:00:00 CST