Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error readng v$sysstat from pl/sql

ow007829Aug 11 2010 — edited Aug 11 2010
I'm running 10g XE on Windows Vista and I was just playing around looking at v$sysstat. The following pl/sql code works fine when run as system (not as sysdba)
declare
   function phys_reads RETURN NUMBER IS
      phys number;
   begin
      select value into phys from v$sysstat where name = 'physical reads';
      return phys;
   end;
begin
   dbms_output.put_line('phys = '||phys_reads);
end;
but if make phys_reads a stand alone procedure like this
create or replace
   function phys_reads RETURN NUMBER IS
      phys number;
   begin
      select value into phys from v$sysstat where name = 'physical reads';
      return phys;
   end;
I get Error(4,35): PL/SQL: ORA-00942: table or view does not exist

Can anyone explain why this is?

Edited by: ow007829 on Aug 10, 2010 11:49 PM
This post has been answered by 618702 on Aug 11 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 8 2010
Added on Aug 11 2010
9 comments
2,166 views