Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4043019
  • 博文数量: 536
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4825
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(536)

文章存档

2024年(3)

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(252)

2006年(73)

分类: Oracle

2008-07-02 21:54:19

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.sql

Procedure 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 privileges
ORA-06512: at "GAN.P_CREATE_TABLE", line 4
ORA-06512: at line 1


============================
Modify the proc_create_tab.sql file:

SQL> @proc_create_tab.sql

Procedure 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_USER

Specify 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.
阅读(2272) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~