Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: how can a PL/SQL identify itself?
Malcolm Dew-Jones wrote:
> bidon70 (bidon70_at_hotmail.com) wrote:
> : Hello everybody,
>
> : I have browsed through the posts but I could not find any problem
> : similar to mine, so I would like to ask you this question:
> : is there a way to uniquely identify a running PL/SQL program (via
the
> : V$ views, sys_context, etc.)?
> : I would like to get a unique identifier for a particular instance
of a
> : program running and the identifier should be retrieved by the
PL/SQL
> : itself.
> : I have tried with v$SESSION and V$PROCESS but it seems they do not
> : contain this kind of info.
>
> What is wrong with the session id?
>
> select userenv('sessionid') from dual ;
>
>
> --
>
> This space not for rent.
Well, there is nothing wrong but there's one thing that puzzles me.
The SQL reference manual for 9.2 under USERENV says "SESSIONID returns
your auditing session identifier." Therefore I assume it has got the
same value as the field V$SESSION.AUDSID. But if I access V$SESSION
where AUDSID=userenv('sessionid') then I will possibly get more than
one row and again I cannot locate the one I'm interested in. Unless I'm
doing something wrong (quite probable) but I cannot see what.
Unluckily there's noone who can help me in my team and the oracle
manuals are not always that clear.
Thanks again.
Received on Fri Jan 21 2005 - 03:02:40 CST