在声明中加authid current_user, 如下:
create or replace procedure ex_dsql_ddldcl(pTableName varchar2) authid current_user is
....  --执行你的create table
end;
这个问题我查了很多资料, 但查到资料都说, 如果定义这个过程与使用这个过程的用户是同一个, 那么authid current_user是不需要加的; 但实验结果是: DDL的DSQL必须加这句.原因不明,可能是oracle版本问题, 我用的9i

解决方案 »

  1.   

    连接到: 
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options09:04:47 stiomdb1@sth01v01>conn test/sxdxcrm@iomtstdb
    已连接。
    09:04:58 iomtstdb@sth01v06>create or replace procedure test_proc as
    09:04:59   2  begin
    09:04:59   3    execute immediate 'CREATE TABLE test_tab
    09:04:59   4  (
    09:04:59   5    c1  VARCHAR2(10)
    09:04:59   6  )';
    09:04:59   7  end test_proc;
    09:05:01   8  /过程已创建。09:05:02 iomtstdb@sth01v06>exec test_proc;PL/SQL 过程已成功完成。09:05:20 iomtstdb@sth01v06>select * from test_tab;未选定行
      

  2.   

    09:11:03 mydb@sth01v06>revoke create any table from test;撤销成功。09:11:45 mydb@sth01v06>drop table test_tab;
    drop table test_tab
               *
    第 1 行出现错误:
    ORA-00942: table or view does not exist
    09:12:08 mydb@sth01v06>drop table test.test_tab;表已删除。09:12:26 mydb@sth01v06>exec test.test_proc;
    BEGIN test.test_proc; END;*
    第 1 行出现错误:
    ORA-01031: insufficient privileges
    ORA-06512: at "TEST.TEST_PROC", line 3
    ORA-06512: at line 109:13:13 mydb@sth01v06>conn test/test@mydb
    已连接。
    09:13:27 mydb@sth01v06>exec test_proc;
    BEGIN test_proc; END;*
    第 1 行出现错误:
    ORA-01031: insufficient privileges
    ORA-06512: at "TEST.TEST_PROC", line 3
    ORA-06512: at line 1
    09:13:34 mydb@sth01v06>
      

  3.   

    你需要进行显示的授权用sysdba特权登录数据库并把create table权限授予你使用的那个用户 如grant create table to aa;
      

  4.   

    楼上,
    我之前的测试把DBA都授予了, 难道一定要授予create table? 我一般建user都是给connect和resource就ok了.. 除非有些特殊要求的user.
      

  5.   

    --------------------------------------------------------------
    您好,我们是“2006中国杰出数据库工程师评选”活动组委会。
    您的帖子已经被我们转载到本次评选官方网站的“专家在线答疑”区。
    http://www.bestdba.cn/match_discussion.aspx在那里,进入本次评选复选的90位数据库工程师将与您展开积极的互动。
    一方面,他们会为您的问题提供满意的答案,
    另一方面,也邀请您为他们投上宝贵的选票。2006-7-8 ~ 2006-7-25日,每天我们将从当天参与"有奖投票"的网友
    中抽取3名幸运者,赠送由IBM提供的精美礼品一份!此外,您还可以在“专家在线答疑”区提出新的问题并参与讨论。您的帖子位于:
    http://www.bestdba.cn/match_discussion3.aspx?pointid=286&pointid2=1&pointid3=5&pcount=stc非常感谢您对本次活动的支持!
    --------------------------------------------------------------
      

  6.   

    10G授予了create any table权限就可以了!