Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Problems With Using V$SESSION Procedure
In article <77439c33.0208120948.6e44589f_at_posting.google.com>, yitbsal_at_yahoo.com
says...
>
>Hi,
>
>The following anonymous compiles:
>
>declare
>a v$session.SID%type;
>begin
>select min(SID) into a from v$session;
>dbms_output.put_line(a);
>end;
>
>However, take the above and put it in a stored procedure, and it does
>not compile, giving the error "PLS-00201: identifier 'V$SESSION' must
>be declared":
>
>create or replace procedure foo is
>a v$session.SID%type;
>begin
>select min(SID) into a from v$session;
>dbms_output.put_line(a);
>end;
>
>Now this problem occurs only with the V$ views, but not with other
>system tables or views such as ALL_ARGUMENTS, ALL_TABLES, etc.
>
>The above code was compiled under an account that has been assigned
>the DBA.
>
>Help?!
>
>Thanks,
>Salaam
see
http://asktom.oracle.com/~tkyte/Misc/RolesAndProcedures.html
roles are never enabled during the compilation of a procedure.
grant select on v_$session to user
directly. ALL_* USER_* views are granted to public, you have direct access to them, not via a role as you do with v_$session. (v$session being a synonym that points to the view v_$synonym)
-- Thomas Kyte (tkyte@oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Mon Aug 12 2002 - 13:15:39 CDT
![]() |
![]() |