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!

ORA-00942 error in simple stored proc

651796Jul 24 2008 — edited Jul 24 2008
Guys,

I'm trying to learn to write some procedures in oracle and have started with the following;

CREATE OR REPLACE PROCEDURE sp__who
IS
BEGIN
FOR rec IN (SELECT s.SID, s.serial#, p.spid, s.osuser, s.program,
s.status
FROM v$process p, v$session s
WHERE p.addr = s.paddr)
LOOP
DBMS_OUTPUT.put_line ('SID: ' || rec.SID);
DBMS_OUTPUT.put_line ('Serial Nbr: ' || rec.serial);
DBMS_OUTPUT.put_line ('SPID: ' || rec.spid);
DBMS_OUTPUT.put_line ('OS User: ' || rec.osuser);
DBMS_OUTPUT.put_line ('Program: ' || rec.program);
DBMS_OUTPUT.put_line ('Status: ' || rec.status);
DBMS_OUTPUT.put_line ('------------------------------');
END LOOP;
END sp__who;
/

SHOW ERRORS;

This is failing with a PL/SQL: ORA-00942: table or view does not exist - it seems to be complaining about v$session and v$process - I do have access to these as I can run the select by itself fine...

Any ideas why?

Also, can anyone suggest a good website for learning PL/SQL and oracle procedure writing?

Cheers!
Pete
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 21 2008
Added on Jul 24 2008
5 comments
1,370 views