博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

Gan's Blog

小记一些个人学习的东西, 如有版权问题请及时告之! :::欢迎转载,已经是转载的请使用原地址::: 转载请注名来源!

Unix/Linux、Oracle、数据存储、备份、复制、ETL、数据仓库
   gan.cublog.cn
关于作者  
姓名:gan
年龄:27
Email: ghk_love#163.com
职业:Oracle, Unix/Linux, C
!>> 想全了50%就可以行动了, 在行动中思考总结!

我的分类  




Oracle Create Procedure Error!
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.

 TAG Oracle Procedure ORA-01031
 发表于: 2008-07-02,修改于: 2008-07-02 21:55 已浏览225次,有评论0条 推荐 投诉

  网友评论

  发表评论



Copyright © 2001-2006 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们
页面生成时间:0.01451

京ICP证041476号