RCorfman......
Thank you very much for your answer.
I granted the select on priveleges to v_$instance. Now its working. Thanks a lot.
Regards
Hiranya.
Main Topics
Browse All TopicsHi.
I tried to execute following SQL statement in a PL/SQL programm unit. But it raise an error when I try to compile the programme unit.
SQL> SELECT instr(lower(instance_name)
2 FROM sys.v_$instance;
INSTR(LOWER(INSTANCE_NAME)
--------------------------
3
SQL> CREATE OR REPLACE procedure test as
2 ext number;
3 begin
4 SELECT instr(lower(instance_name)
5 into ext
6 FROM sys.v_$instance;
7 dbms_output.put_line(ext);
8 end;
9 /
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE TEST:
LINE/COL ERROR
-------- --------------------------
4/1 PL/SQL: SQL Statement ignored
6/10 PL/SQL: ORA-00942: table or view does not exist
SQL>
Please help.
Regards
Hiranya
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: RCorfmanPosted on 2006-03-28 at 21:30:36ID: 16318348
If you have access to this from sql*plus by describing it, but it doesn't work in a procedure, it is because your grant to the table is via a role. There are two ways around this. Have the dba do a DIRECT GRANT to your user, not through a role.
,'tst')
e.com/Data bases/Orac le/ Q_21762 459.html
The reason is that pl/sql procedures are, by default, run with definer rights. Definer rights procedures suspend all roles while executing. If you turn this into an invoker rights procedure, then the procedure will execute with roles enabled, but whoever tries to run the procedure will also need rights to sys.v_$instance to run the procedure. This is the trade-off. Definer rights, you can grant execute on the procedure and anyone can do what the procedure enables, but the grants have to be direct, not roles.
Invoker rights, the roles stay active, but only those who have the grants to the objects in the procedure can access them.
To turn your procedure into an invoker rights procedure do this:
CREATE OR REPLACE procedure test AUTHID CURRENT_USER As
ext number;
begin
SELECT instr(lower(instance_name)
into ext
FROM sys.v_$instance;
dbms_output.put_line(ext);
end;
/
See here for additional information
http://www.experts-exchang