insufficient privileges upon executing stored procedure
775972Nov 14 2012 — edited Nov 15 2012Hello Gurus,
i am new to plsql, working on a stored procedure.
basically, trying to create a temporary table using dynamic sql .. below is my code,upon executing , i am encoutering insufficient privileges error. not sure where i am going wrong. any help is highly appreciated, thanks
---------code - successfully compiled----------
SQL> CREATE OR REPLACE procedure stp_temp (i_table in varchar2)
2 is
3 table_creation_stmt varchar2(4000):='';
4 begin
5
6 table_creation_stmt := 'CREATE GLOBAL TEMPORARY TABLE '||i_table|| ' AS select * from TABLE_STGG';
7 dbms_output.put_line ('Query is :'||table_creation_stmt);
8 execute immediate table_creation_stmt;
9 end;
10 /
Procedure created.
SQL> exec stp_temp('table123');
Query is :CREATE GLOBAL TEMPORARY TABLE table123 AS select * from TABLE_STGG
BEGIN stp_temp('table123'); END;
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "E3US9T.STP_TEMP", line 8
ORA-06512: at line 1
------table gets created upon copy/paste from above output ( query is)
SQL> CREATE GLOBAL TEMPORARY TABLE table123 AS select * from TABLE_STGG;
Table created.