Home » SQL & PL/SQL » SQL & PL/SQL » insufficient privileges !!!!!
icon5.gif  insufficient privileges !!!!! [message #278765] Mon, 05 November 2007 11:24 Go to next message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

Look for this code :-

SQL> conn system
Enter password: *
Connected.

SQL> grant dba to hr;
Grant succeeded.

SQL> conn hr
Enter password: *
Connected.


SQL> CREATE OR REPLACE PROCEDURE backup_tabs
  2  IS
  3     v_statment   VARCHAR2 (300);
  4  
  5     CURSOR tabs
  6     IS
  7        SELECT table_name
  8          FROM user_tables;
  9  BEGIN
 10     FOR i IN tabs
 11     LOOP
 12        v_statment :=
 13           'CREATE TABLE C_' || i.table_name || ' AS SELECT*FROM '
 14           || i.table_name;
 15  
 16        EXECUTE IMMEDIATE v_statment;
 17     END LOOP;
 18  END;
 19  /

Procedure created.

SQL> -- and when EXECUTE the PROCEDURE surprised by that:-
SQL> 
SQL>  BEGIN
  2   backup_tabs;
  3   END;
  4   /
 BEGIN
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "HR2.BACKUP_TABS", line 16
ORA-06512: at line 2


why that's happen ???

Re: insufficient privileges !!!!! [message #278768 is a reply to message #278765] Mon, 05 November 2007 11:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64448
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You don't have "create table" privilege directly granted to you.

Regards
Michel

[Updated on: Mon, 05 November 2007 11:29]

Report message to a moderator

Re: insufficient privileges !!!!! [message #278807 is a reply to message #278768] Mon, 05 November 2007 14:11 Go to previous message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

thanks it's working Surprised
Previous Topic: data unload from a table with daily partition
Next Topic: Replacing IN with EXISTS
Goto Forum:
  


Current Time: Thu Feb 23 10:23:57 CST 2017

Total time taken to generate the page: 0.12088 seconds