v$sql: table or view does not exists into PL/SQL
Hi,
I'm trying to create e job that will execute some pl/sql to check something concerning sessions and session's sql text.
I wrote the query:
SELECT s.username, s.osuser, s.machine, s.program, t.sql_text current_statement, t_prev.sql_text previous_statement
FROM v$sql t, v$session s, v$sql t_prev
WHERE t.sql_id = s.sql_id
AND s.status = 'ACTIVE'
AND s.schemaname = MYSHEMANAME
AND s.seconds_in_wait > 60
AND t_prev.sql_id = s.prev_sql_id;
This query works fine, but as soon as I include it in a PL/SQL, I get the compiling error: Error(248,21): PL/SQL: ORA-00942: table or view does not exist.
Someone has some suggestions?
Thanks in advance.
Samuel