Solved

Insufficient Privileges (execute immediate)

Posted on 2001-08-15
5
1,226 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now