Solved

Insufficient Privileges (execute immediate)

Posted on 2001-08-15
5
1,235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

691 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