Create table problem using Dynamic Query [message #135986] |
Mon, 05 September 2005 04:21 |
Achchan
Messages: 86 Registered: June 2005
|
Member |
|
|
Hi all,
I want to create a temporary table within a stored procedure so I decided to do it using a dynamic query:
create or replace procedure p1
as
begin
execute immediate 'CREATE GLOBAL TEMPORARY TABLE tt(id number(2))';
end;
/ It created successfuly but when I execute that procedure I got:SQL> exec p1;
BEGIN p1; END;
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SCOTT.P1", line 4
ORA-06512: at line 1 While I can create that table using the same user without any problem!
My question is:What privilege should I grant to user(minimum of privileges please! ) to execute that procedure successfuly?
-Thanks
|
|
|
Re: Create table problem using Dynamic Query [message #135998 is a reply to message #135986] |
Mon, 05 September 2005 05:45 |
somnath74
Messages: 6 Registered: June 2005
|
Junior Member |
|
|
Hi,
In case you are executing the stored procedure with some other schema other than the schema under which the STP has been compiled then you need to grant the EXECUTE permissioon on the STP to that schema which is executing the STP.
Also please note that the privileges that are applicable when a STP is executed is all that pertains to the owner of the STP and not that of the invoker.
Hope this helps !!
Regards,
Somnath
|
|
|
|
Re: Create table problem using Dynamic Query [message #136163 is a reply to message #135986] |
Tue, 06 September 2005 08:14 |
smartin
Messages: 1803 Registered: March 2005 Location: Jacksonville, Florida
|
Senior Member |
|
|
Note that in general, when people attempt to do this, it is because they are familiar with another database besides oracle and are trying to copy what they did in that database. Normally, creating a temporary table as you are trying to do is something that is not needed in Oracle, and there are better ways to accomplish your goal.
|
|
|
|
|