How to identify my session?(m52)


I would like to find some way to identify my Oracle app's session.
I know there's a v$session, but don't know which is my current
session. I'm trying to generate an unique table name. I think that
can be done by prefixing the current session's id to the table name.



Ans1:

You could create a database sequence that is incremented by 1 everytime
you need to create a table. You could also use the session's id as you
were suggesting. The one problem is that the first character of the
table should be Alpha, and not numeric, which would be the case if you
took either an Oracle Sequence or userenv('sessionid'), so you should be
suffixing the tablename with the unique number.

Another option, if you have Oracle8i is to create a global temporary
table, which from what I can figure, is a C structure in memory. With
this, you can define a table structure, and when you insert data into
this table, only you can see the contents of the table. You can define
the data to be available for a Session or a Transaction.



Ans2:

Issue the following statement to find out your session id

select userenv('sessionid') from dual

Reply:

That will just give you the AUDSID.  To get the value of the session ID,
you need to:

select sid from v$session where audsid = userenv('sessionid');
 
 
 

Hosted by www.Geocities.ws

1