Solved

Oracle 10g Granted privileges and dynamic sql

Posted on 2007-11-15
4
2,836 Views
Last Modified: 2012-06-22
Oracle 10g I have a stored procedure that I invoke from a sql*plus session connected as schema ca50633. It executes the following command which fails with an error message about insufficient privileges.

COMMAND := 'TRUNCATE TABLE RT_TEST.STATIC_DATA';      
EXECUTE IMMEDIATE COMMAND;

I have granted ca50633 all privileges on the rt_test.static_data table from the rt_test schema and can truncate the table interactively from sql*plus.

What am I missing?
0
Comment
Question by:rmtye
  • 2
4 Comments
 
LVL 1

Expert Comment

by:bobbymanocha
ID: 20292113
PL/SQL doesn't recognize privileges granted through roles.  The privilege needs to be granted directly.
 
grant drop any table to ca50633;
0
 
LVL 18

Expert Comment

by:Jinesh Kamdar
ID: 20292130
GRANT TRUNCATE ON rt_test.static_data TO ca50633;
0
 

Author Comment

by:rmtye
ID: 20292316
I granted all on rt_test.static_data to ca50633; but, it didn't help.

Grant truncate returned an error message
0
 
LVL 1

Accepted Solution

by:
bobbymanocha earned 125 total points
ID: 20292361
grant all grants object privileges.    You need a system privilege here, and 'grant drop any table to ca50633' will do that for you.

Alternatively, compile the stored procedure in the rt_test schema and grant execute on the procedure to ca50633.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
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…
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.

867 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

15 Experts available now in Live!

Get 1:1 Help Now