?
Solved

select from the table v$sesstat in a stored procedure

Posted on 2004-04-30
3
Medium Priority
?
1,095 Views
Last Modified: 2012-05-04
Hi!

I want to make a stored procedure that select values from the table v$sesstat.

I'm logged into sqlplus as System.

The problem is that i get the error:
_________________________________________________

Errors for PROCEDURE SP_MEMORY2:

LINE/COL ERROR
-------- -------------------------------------------------------------
12/2     PL/SQL: SQL Statement ignored
13/7     PL/SQL: ORA-00942: table or view does not exist

___________________________________________________

this is the procedure I try to use:
____________________________________

create or replace procedure sp_memory2
as

      memsum number(12) := 0;
      thetime date;
      
      
      
begin

      thetime := sysdate;
      select sum(value) into memsum
      from v$sesstat;
                  
      dbms_output.put_line('The size is: ' || memsum || ' and the date and time is: ' || thetime);
      
end;
/
__________________________________

Can anyone tell me why this doesn't work and what I need to do to get to use this table in a stored procedure?

Greetings,

Tom-Erik
0
Comment
Question by:tomerikv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Expert Comment

by:seazodiac
ID: 10965099
Can anyone tell me why this doesn't work and what I need to do to get to use this table in a stored procedure?

1. because system account does not have access to this view v$sesstat;

2. log in as SYSDBA,

SQL>grant select on v$sesstat to system;


then try your procs
0
 
LVL 3

Accepted Solution

by:
dbms_chu earned 380 total points
ID: 10965134
Try logging in as sysdba then:

sql> grant select on sys.v_$sesstat to system;

0
 
LVL 1

Author Comment

by:tomerikv
ID: 10966696
Hi!

The anwer from seazodiac gave an error because of the lack of the underscore before $, but thanks to both of you!

: )

greetings,

Tom-Erik




0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question