?
Solved

Insufficient Privileges (execute immediate)

Posted on 2001-08-15
5
Medium Priority
?
1,241 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 40 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

830 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