Bad example. What the problem is V$session is a SYS object and requires a (sort of) direct grant to the user. The grant must be on V_$Session. Grant select on V_$session to MyUser;
Then the procedure PR_TEST_SESSION would compile.
But to the problem at hand. Could you post the procedure that parses the timezone
Main Topics
Browse All Topics





by: sujit_kumarPosted on 2005-01-31 at 18:44:55ID: 13189092
SQL and PL/SQL engines use different parsers. for eaxmple you can use V$SESSION inside a sql statement. But you can't do it directly through a procedure,
select * from V$SESSION where program = 'TOAD.exe'
and rownum < 2
1 row selected.
declare
n number;
begin
select sid into n from V$SESSION where program = 'TOAD.exe'
and rownum < 2;
dbms_output.put_line('N = '||n);
end;
N = 11
create or replace procedure PR_TEST_SESSION is
n number;
begin
select sid into n from V$SESSION where program = 'TOAD.exe'
and rownum < 2;
dbms_output.put_line('N = '||n);
end;
Warning: Procedure created with compilation errors
show error
PLS-00201: identifier 'SYS.V_$SESSION' must be declared
So it may happen. Can you post the query and it's result from SQL*PLUS. So that we can think of some alternatives/work-around.
Sujit