Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: V$ select in stored procedure not working

Re: V$ select in stored procedure not working

From: Rafal Jank <yankee_at_wp-sa.pl>
Date: Fri, 06 Apr 2001 13:48:03 +0200
Message-ID: <3ACDACF3.116C7D00@wp-sa.pl>

> create or replace procedure AUDITTHIS (
> pTableName IN varchar2,
> pOperation IN varchar2
> ) IS
> Begin
> INSERT INTO AUDITINFO
> (AUDSID, ORACLEUSER, SCHEMANAME, OSUSER, WORKSTATION, LOGONTIME,
> SOURCETABLE, OPERATION)
> select MAX(s.AUDSID), MAX(s.USERNAME), MAX(s.SCHEMANAME),
> MAX(sci.OSUSER), MAX(s.TERMINAL), MAX(s.LOGON_TIME), pTableName, pOperation
> from V$SESSION s, V$SESSION_CONNECT_INFO sci
> where s.SID = sci.SID
> and s.AUDSID = userenv('sessionid')
> group by s.SID;
> End;
>
> It gives an error saying it can't find v$session. Replacing it with
> sys.v_$session doesn't help either.
>
> Why is the visibility for select on that table/view different when you do it
> from a stored procedure or trigger? What can I do to get this to work?
You must be granted select to v$session directly, not through the role. Rafal Received on Fri Apr 06 2001 - 06:48:03 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US