ORA-00942 error in simple stored proc
651796Jul 24 2008 — edited Jul 24 2008Guys,
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