dbTalk Databases Forums  

ora-01031 (insuff priv) while create table in package

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss ora-01031 (insuff priv) while create table in package in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Norbert Winkler
 
Posts: n/a

Default ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:25 AM






Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
-->
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

--
Norbert

Reply With Quote
  #2  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:49 AM







"Norbert Winkler" <norbert.winkler1 (AT) gmx (DOT) de> wrote

Quote:
Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
--
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

--
Norbert
Why do you want to do this? In general this is a very bad idea. If you
want a "temporary table" in a manner similar to MS SQLServer uses in stored
procs then look up global temporary table in the Oracle Docs. A global
temporary table is created 1 time not by each user.
Jim




Reply With Quote
  #3  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:49 AM




"Norbert Winkler" <norbert.winkler1 (AT) gmx (DOT) de> wrote

Quote:
Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
--
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

--
Norbert
Why do you want to do this? In general this is a very bad idea. If you
want a "temporary table" in a manner similar to MS SQLServer uses in stored
procs then look up global temporary table in the Oracle Docs. A global
temporary table is created 1 time not by each user.
Jim




Reply With Quote
  #4  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:49 AM




"Norbert Winkler" <norbert.winkler1 (AT) gmx (DOT) de> wrote

Quote:
Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
--
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

--
Norbert
Why do you want to do this? In general this is a very bad idea. If you
want a "temporary table" in a manner similar to MS SQLServer uses in stored
procs then look up global temporary table in the Oracle Docs. A global
temporary table is created 1 time not by each user.
Jim




Reply With Quote
  #5  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:49 AM




"Norbert Winkler" <norbert.winkler1 (AT) gmx (DOT) de> wrote

Quote:
Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
--
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

--
Norbert
Why do you want to do this? In general this is a very bad idea. If you
want a "temporary table" in a manner similar to MS SQLServer uses in stored
procs then look up global temporary table in the Oracle Docs. A global
temporary table is created 1 time not by each user.
Jim




Reply With Quote
  #6  
Old   
Ana C. Dent
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:52 AM



Norbert Winkler <norbert.winkler1 (AT) gmx (DOT) de> wrote in news:1m1vnzjxjn4k
$.18fffz57ac0tj$.dlg (AT) 40tude (DOT) net:

Quote:
Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
--
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

You should NOT be dynamically creating & dropping tables in Oracle.

Privs acquired via ROLE do not apply within PL/SQL named procedures.


Reply With Quote
  #7  
Old   
Ana C. Dent
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:52 AM



Norbert Winkler <norbert.winkler1 (AT) gmx (DOT) de> wrote in news:1m1vnzjxjn4k
$.18fffz57ac0tj$.dlg (AT) 40tude (DOT) net:

Quote:
Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
--
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

You should NOT be dynamically creating & dropping tables in Oracle.

Privs acquired via ROLE do not apply within PL/SQL named procedures.


Reply With Quote
  #8  
Old   
Ana C. Dent
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:52 AM



Norbert Winkler <norbert.winkler1 (AT) gmx (DOT) de> wrote in news:1m1vnzjxjn4k
$.18fffz57ac0tj$.dlg (AT) 40tude (DOT) net:

Quote:
Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
--
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

You should NOT be dynamically creating & dropping tables in Oracle.

Privs acquired via ROLE do not apply within PL/SQL named procedures.


Reply With Quote
  #9  
Old   
Ana C. Dent
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 08:52 AM



Norbert Winkler <norbert.winkler1 (AT) gmx (DOT) de> wrote in news:1m1vnzjxjn4k
$.18fffz57ac0tj$.dlg (AT) 40tude (DOT) net:

Quote:
Hi,

I can't do a create table in a package procedure. A drop jedoch is
possible.
With google I doesn't find any hint for a necessary privilege.

Here is the test package:
_____________________________________
CREATE OR REPLACE package DDL_IN_PACKAGE is
procedure TestDROP;
procedure TestCreate;
end DDL_In_Package;
/
CREATE OR REPLACE package body DDL_IN_PACKAGE is
procedure TestDROP is
begin
execute immediate 'DROP TABLE XXX';
end;
procedure TestCreate is
begin
execute immediate 'CREATE TABLE XXX (a integer)';
end;
end DDL_In_Package;
/
_____________________________________


Here is the code that works:

_____________________________________
-- drop TABLE XXX;
CREATE TABLE XXX (a integer);

begin
ddl_in_package.testdrop;
-- ddl_in_package.testcreate;
end;
/

Here is the code that fails:
_____________________________________
drop TABLE XXX;
--CREATE TABLE XXX (a integer);

begin
-- ddl_in_package.testdrop;
ddl_in_package.testcreate;
end;
/
--
ORA-01031: insufficient privileges
ORA-06512: at "DDL_IN_PACKAGE", line 10
______________________________________

Thanks for any suggestion

You should NOT be dynamically creating & dropping tables in Oracle.

Privs acquired via ROLE do not apply within PL/SQL named procedures.


Reply With Quote
  #10  
Old   
Norbert Winkler
 
Posts: n/a

Default Re: ora-01031 (insuff priv) while create table in package - 07-14-2008 , 09:59 AM



Quote:
Why do you want to do this? In general this is a very bad idea. If you
want a "temporary table" in a manner similar to MS SQLServer uses in stored
procs then look up global temporary table in the Oracle Docs. A global
temporary table is created 1 time not by each user.
my problem doesn't deal with temp-tables, my example-sql probably confuses
you.

Quote:
Jim
Sorry if I'm explaining too much details:

I've written a package that manage nested sets.
It uses two tables:
one for the attributes and the other for the tree structures.

I've written it with dynamical SELECT/INSERT/UPDATES/DELETE statements, so
that the user can choose the table names and the names of essential fields
of the attribut-table.
(there is i.E a SetTabNameTree procedure)
So he can add nested-functionality to his existing flat tables without
changing anything.

Now I want to write a service-package that create all tables, sequences
triggers and views withe the user choosen names.

If it doesn't work, I've to write a client-application to create the
necessary database-objects, or the user must do it by a string-replaces
itself.

--
Norbert


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.