Solved

Insufficient Privileges (execute immediate)

Posted on 2001-08-15
5
1,231 Views
Last Modified: 2010-05-18
I created the following stored procedure for
dinamycally execute a DDL Sentence.

procedure ejecuta (sentence  in varchar2)
begin
execute immediate sentence;
end;

And it works well for DML Sentences, but
when I try to execute a DDL sentence like:

create table a (a number);

I receive an ORA-01031: Insufficient Priveleges

But the user that executes and owns the stored
procedure has DBA privileges.

If someone has any idea, please help me, I
will be grateful, if you do so ...

0
Comment
Question by:czoller
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
ser6398 earned 10 total points
ID: 6389975
Does the user have CREATE ANY TABLE privilege?  Is it granted to that user through a ROLE, or specifically granted to that user?  If it is through a ROLE, you may have to specifically grant it to that USER.
0
 
LVL 5

Expert Comment

by:ser6398
ID: 6389982
i.e. Try the following:

GRANT CREATE ANY TABLE TO user_name;
0
 
LVL 2

Author Comment

by:czoller
ID: 6391112

Thank you so much, I didn't realize
that when I'm executing dynamic sql
privileges granted from roles are not valid
they have to be given directly ...

Thanks ...
0
 
LVL 5

Expert Comment

by:ser6398
ID: 6391206
It's not the dynamic sql, it is the Stored Procedure.  Stored Procedures are created with Owner's Rights.  If you give me the ability to execute a stored procedure in your schema, then I can execute it and it will run just like I have your privileges.  This allows you to give users the ability to access your tables only through the stored procedure (not give any table rights to people, but give them execute on the stored procedures you want, and they can access your tables through the stored procedures).  To make something work in a stored procedure, privileges normally have to be explicitly granted to the user and not granted through a role.
0
 
LVL 2

Author Comment

by:czoller
ID: 6393127
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question