Skip to Main Content

SQL & PL/SQL

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!

select from V$SESSION in function: ORA-00942: table or view does not exist

565983Mar 21 2007 — edited Mar 21 2007
Hi all,

I want to write a package function that returns the number of active sessions, I try with the code below:

FUNCTION clientSessionCount RETURN NUMBER AS
retValue NUMBER;
BEGIN
SELECT COUNT(*) INTO retValue FROM V$SESSION
WHERE UPPER(PROGRAM) NOT LIKE 'ORACLE.EXE%';
RETURN retValue;
END clientSessionCount;

The result of compiling is: ORA-00942: table or view does not exist
But the query SELECT COUNT(*) FROM V$SESSION executed with the same user that owns the package works without errors.
What is my mistake?

Thanks and regards.

Maurizio
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2007
Added on Mar 21 2007
2 comments
3,798 views