473,412 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

ORA-00911 in Dynamic SQL

I am trying to create a stored procedure with dynamic sql referencing
the V$SESSION table (view). I need to use this dynamically, because
the procedure will not compile if the user does not have access to
this table. The $ is what's causing the trouble:

declare v_sql varchar2(4000);
begin
v_sql := 'select * from v$session;';
execute immediate (v_sql);
end;
/
I've tried \ and double quotes, but they don't work. Any clues?

THANK YOU!!!!

trace
Jul 19 '05 #1
5 9715
traceable1 wrote:
I am trying to create a stored procedure with dynamic sql referencing
the V$SESSION table (view). I need to use this dynamically, because
the procedure will not compile if the user does not have access to
this table. The $ is what's causing the trouble:

declare v_sql varchar2(4000);
begin
v_sql := 'select * from v$session;';
execute immediate (v_sql);
end;
/
I've tried \ and double quotes, but they don't work. Any clues?

THANK YOU!!!!

trace


declare v_sql varchar2(4000);
begin
v_sql := 'select * from v$session';
execute immediate v_sql;
end;
/

Jul 19 '05 #2
tr********@hotmail.com (traceable1) wrote in message news:<85*************************@posting.google.c om>...
I am trying to create a stored procedure with dynamic sql referencing
the V$SESSION table (view). I need to use this dynamically, because
the procedure will not compile if the user does not have access to
this table.


Untrue. Create the procedure with authid current_user or grant direct
privilege to the user, and dump the dynamic sql.
Not sure why you would need any user to do this though.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #3
This is for an application in which a user can be running multiple
processes. Some of our clients do not want their users to have access
to v$session, so the procedure needs to be written in such a manner
that it uses v$session for clients who will grant the access, and thus
have the added feature of running multiple processes, or, it they
choose not to grant the access, the procedure goes another route.
If they choose not to grant access, the procedure will not compile
unless it is run via dynamic SQL.
sy******@yahoo.com wrote in message news:<a1**************************@posting.google. com>...
tr********@hotmail.com (traceable1) wrote in message news:<85*************************@posting.google.c om>...
I am trying to create a stored procedure with dynamic sql referencing
the V$SESSION table (view). I need to use this dynamically, because
the procedure will not compile if the user does not have access to
this table.


Untrue. Create the procedure with authid current_user or grant direct
privilege to the user, and dump the dynamic sql.
Not sure why you would need any user to do this though.

Sybrand Bakker
Senior Oracle DBA

Jul 19 '05 #4
tr********@hotmail.com (traceable1) wrote in message news:<85**************************@posting.google. com>...
This is for an application in which a user can be running multiple
processes. Some of our clients do not want their users to have access
to v$session, so the procedure needs to be written in such a manner
that it uses v$session for clients who will grant the access, and thus
have the added feature of running multiple processes, or, it they
choose not to grant the access, the procedure goes another route.
If they choose not to grant access, the procedure will not compile
unless it is run via dynamic SQL.


Sounds like you want to create a "utility" userid or schema and
compile the procedure there. Then grant execute on that procedure to
whoever needs it. You can grant the priv to see v$session to that
userid so the proc will compile ..

Note - nobody actually logs in using that userid, they still use their
own login, they just run a procedure that belongs to somebody else ...
no big deal .. (btw - you'll probably want to use Public Synonym for
this as well) ..

The Elementalist
Jul 19 '05 #5
Thank you for you response. Unfortunately, the installation of this
database schema is run completely by the user. We cannot have the
clients log in w/dba rights and create another user for this
procedure.
Is the $ added in to the name of these views just to make it
impossible to use in dynamic SQL?

Thanks,
trace
th**************@hotmail.com (The Elemenatlist) wrote in message news:<d0**************************@posting.google. com>...
tr********@hotmail.com (traceable1) wrote in message news:<85**************************@posting.google. com>...
This is for an application in which a user can be running multiple
processes. Some of our clients do not want their users to have access
to v$session, so the procedure needs to be written in such a manner
that it uses v$session for clients who will grant the access, and thus
have the added feature of running multiple processes, or, it they
choose not to grant the access, the procedure goes another route.
If they choose not to grant access, the procedure will not compile
unless it is run via dynamic SQL.


Sounds like you want to create a "utility" userid or schema and
compile the procedure there. Then grant execute on that procedure to
whoever needs it. You can grant the priv to see v$session to that
userid so the proc will compile ..

Note - nobody actually logs in using that userid, they still use their
own login, they just run a procedure that belongs to somebody else ...
no big deal .. (btw - you'll probably want to use Public Synonym for
this as well) ..

The Elementalist

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Subrahmanyam Arya | last post by:
Dear oracle gurus, I am unable to get past the error ORA-12154: TNS: could not resolve service name on my host when using hsodbc to talk to a remote mysql database. i got from the meta link all...
6
by: John | last post by:
Hi Right password -> ORA-12154: TNS:Could not resolve service name wrong password => ORA-01017: invalid username/password; logon denied Tested on a Windows XP client connecting to Oracle on...
1
by: Park Yeon Jo | last post by:
About Error : ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect descriptor I installed Oracle 8.1.7 on Windows XP Professional. and I wanto connect to that server...
1
by: Adam Ruth | last post by:
I'm using OCI on Mac OS X and I've run into a strange problem with my TNSNAMES.ORA file. My TNSNAMES.ORA file has one entry INV4II and it works fine. However, it will only work if that is the...
6
by: bdj | last post by:
Hello! I have at set of tnsnames.ora. I wich to make an union, e.g. a single file of it. How can I do that easy? Greetings Bjørn
4
by: Tig | last post by:
Hi all. I have a need to connect to an Oracle 7.3.3.5 database. I have a user who successfully connects to it with her Oracle 7.3 client. I have an Oracle 9.2 client installed on my machine. ...
2
by: mpatel6 | last post by:
I had this error in alert log and my instance was down, anybody can help me? Errors in file /u01/app/oracle/admin/sotstest/bdump/sotstest_p004_626740.trc: ORA-07445: exception encountered: core...
5
by: mivey4 | last post by:
Hi, First off, I am aware that this is a very heavily documented error and I have done my homework for throughly researching probable causes before deciding to post my problem here. At this point,...
0
by: basmgokul | last post by:
I am using oracle 10g in windows vista.. when starting DB it throws an error Errors in file c:\database\udump\practice_ora_440.trc: ORA-00704: bootstrap process failure ORA-39700: database...
1
by: michael ngong | last post by:
michael.john@gmx.at (Michael John) wrote in message news:<90cc4edd.0306230900.28075193@posting.google.com>... MIchael I you stated the OS and platform that could make it easier to address your...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.