SQL>
select * from v$version;BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
select * from dba_role_privs where grantee = 'GAN';GRANTEE GRANTED_ROLE ADM DEF
------------------------------ ------------------------------ --- ---
GAN CONNECT NO YES
GAN DBA NO YES
SQL>
@proc_create_tab.sqlProcedure created.
SQL>
l 1 create or replace procedure p_create_table
2 is
3 begin
4 execute immediate 'create table TAB2(col1 INT)';
5* end;
SQL>
exec p_create_table;BEGIN p_create_table; END;
*
ERROR at line 1:ORA-01031: insufficient privilegesORA-06512: at "GAN.P_CREATE_TABLE", line 4ORA-06512: at line 1============================
Modify the proc_create_tab.sql file:
SQL>
@proc_create_tab.sqlProcedure created.
SQL>
l 1 create or replace procedure p_create_table
2 authid current_user is
3 begin
4 execute immediate 'create table TAB2(col1 INT)';
5* end;
SQL>
exec p_create_table;PL/SQL procedure successfully completed.
Learn From:
http://space.itpub.net/756652/viewspace-242337===============================
Oracle Document Info:
AUTHID CURRENT_USERSpecify CURRENT_USER to indicate that the procedure executes with the privileges of CURRENT_USER. This clause creates an invoker-rights procedure.
This clause also specifies that external names in queries, DML operations, and dynamic SQL statements resolve in the schema of CURRENT_USER. External names in all other statements resolve in the schema in which the procedure resides.
AUTHID DEFINER
Specify DEFINER to indicate that the procedure executes with the privileges of the owner of the schema in which the procedure resides, and that external names resolve in the schema where the procedure resides. This is the default and creates a definer-rights procedure.
阅读(2265) | 评论(0) | 转发(0) |