Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: selecting osuser info inside a stored proc
Knut Talman wrote:
> clueless wrote:
> >
> > Hi gang,
> >
> > I am writing a pl/sql stored procedure. Inside the procedure I want to
> > determine the osuser who is executing the stored proc. The user will NOT
> > have dba privileges, i.e. this will be a NORMAL user. Any ideas, hints,...
> >
> > I was thinking about creating another stored function owner by a dba that
> > would return the osusers from v$session when called (execute priv would be
> > granted to the NORMAL user). The problem is that this view (v$session) will
> > return all users logged in.
>
> The view v$mystat shows your SID. Knowing it you can query v$session to get the
> os user.
>
> Regards,
>
> Knut
Good I can post this twice in one day:
SELECT osuser
INTO x
FROM v$session
WHERE sid = (
SELECT sid
FROM v$mystat
WHERE rownum = 1);
;-)
Daniel Morgan Received on Wed May 08 2002 - 10:39:26 CDT