我的程序如下:create or replace procedure aaa
is
       ssql varchar2(1000);
begin
       ssql:='create table asdf as select * from gyf_c';
       execute immediate ssql;
end aaa;哪位高手帮忙解决下??

解决方案 »

  1.   

    我是用system /manager 进入的创建的这个存储过程的啊
      

  2.   

    给你创建这个存储过程的用户授予权限
    grant create table to 用户名若是没有创建存储过程的权限的话:grant create procedure to 用户名
      

  3.   

    SQL> create procedure cccccc
      2  as
      3  s_q varchar2(100);
      4  begin
      5  s_q := 'create table cc(id number)';
      6  execute immediate s_q;
      7  end;
      8  /过程已创建。SQL> exec cccccc;
    BEGIN cccccc; END;*
    ERROR 位于第 1 行:
    ORA-01031: 权限不足
    ORA-06512: 在"SYSTEM.CCCCCC", line 6
    ORA-06512: 在line 1
    SQL> conn /as sysdba
    已连接。
    SQL> grant create table to system;授权成功。SQL> conn system/love2008
    已连接。
    SQL> exec cccccc;PL/SQL 过程已成功完成。
      

  4.   

    system应该有create table 的权限阿
    sys@HASL>alter user system identified by manager  account unlock;用户已更改。sys@HASL>conn system/manager@haslxdb
    已连接。
    sys@HASL>create or replace procedure aaa
      2  is
      3  ssql varchar2(1000);
      4  begin
      5  ssql:='create table asdf(id char(10))';
      6  execute immediate ssql;
      7  end aaa;
      8  /过程已创建。sys@HASL>exec aaa;PL/SQL 过程已成功完成。sys@HASL>show user
    USER 为"SYSTEM"
    sys@HASL>select *from asdf;未选定行
      

  5.   

    sys@HASL>create user tt identified by tt account unlock;用户已创建sys@HASL>grant connect to tt;授权成功。sys@HASL>grant resource to tt;授权成功。sys@HASL>grant create table to tt;授权成功。sys@HASL>grant create procedure to tt;授权成功。sys@HASL>conn tt/tt@haslxdb
    已连接。
    sys@HASL>show user
    USER 为"TT"
    sys@HASL>create or replace procedure aaa
      2  is
      3  ssql varchar2(1000);
      4  begin
      5  ssql:='create table asdf(id char(10))';
      6  execute immediate ssql;
      7  end aaa;
      8  /过程已创建。sys@HASL>exec aaa;PL/SQL 过程已成功完成。sys@HASL>select *from asdf
      2  /未选定行sys@HASL>create view tt1 as select *from asdf;
    create view tt1 as select *from asdf
                *
    ERROR 位于第 1 行:
    ORA-01031: 权限不足
    新建了一个用户TT,只需要有create table的权限就可以执行阿sys@HASL>
      

  6.   

    love_2008(love2008),谢谢你了,昨天搞了一个晚上,现在解决了,