Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: problem with select from v$session
A copy of this was sent to Anurag Minocha <anurag_at_synergy-infotech.com>
(if that email address didn't require changing)
On Fri, 06 Aug 1999 12:49:14 +0530, you wrote:
>Hi,
>Most of the questions which i have been posting on this news group have
>not been answered but still i am trying to solve my problem through this
>channel.
>
>My problem is that i have a user with the following roles
>1.resource
>2.connect
>3.dba
>
>If from the sqlplus i query the view v$session it gives me the result
>but if the same select statement inside a stored procedure it says
>v$session not declared. Now if i grant select any table to this user
>then the stored procedure is compiling fine.
>
>Can somebody clear my confusion as to why from the sqlplus the query got
>executed and why not from the stored procedure.
>
>I hope that there is atleast somebody there who is ready to help me.
>
>Thanks
>anurag
>
>also reply at
>anurag_at_synergy-infotech.com
roles are never enabled during the execution of a procedure except in the special case of Invokers Rights which is a new feature in Oracle8i, release 8.1.
This fact is documented application developers guide:
<quote>
Privileges Required to Create Procedures and Functions
To create a stand-alone procedure or function, or package specification or body, you must meet the following prerequisites:
• You must have the CREATE PROCEDURE system privilege to create a procedure or package in your schema, or the CREATE ANY PROCEDURE system privilege to create a procedure or package in another user’s schema.
Attention: To create without errors, that is, to compile the procedure or package successfully, requires the following additional privileges: The owner of the procedure or package must have been explicitly granted the necessary object privileges for all objects referenced within the body of the code; the owner cannot have obtained required privileges through roles.
If the privileges of a procedure’s or package’s owner change, the procedure
must be reauthenticated before it is executed. If a necessary privilege to a
referenced object is revoked from the owner of the procedure (or package), the
procedure cannot be executed.
</quote>
Try this:
SQL> set role none;
SQL> "statement you want to test to see if it'll work in a procedure"
If you can do it in plus with no roles you can do it in a procedure. If you can't, you must have the privelege from a role and hence won't be able to do it in a procedure.
You probably have the privelege to do what you are trying to do in the procedure via a role. Grant the privelege directly to the owner of the procedure and it'll work.
--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Aug 06 1999 - 08:06:47 CDT
![]() |
![]() |