Plsql ora1031在内部创建表时立即执行
我有创建对象krn_ddl_mgr的过程,所以creatin如下所示:Plsql ora1031在内部创建表时立即执行,plsql,oracle11g,dynamic-sql,Plsql,Oracle11g,Dynamic Sql,我有创建对象krn_ddl_mgr的过程,所以creatin如下所示: begin krn_ddl_mgr.create_object('create table krn_modules ( id varchar2(30 byte), description varchar2(4000 byte) ) tablespace MDLDATA rowdependencies'); end; / 并引发ora10
begin
krn_ddl_mgr.create_object('create table krn_modules
(
id varchar2(30 byte),
description varchar2(4000 byte)
)
tablespace MDLDATA
rowdependencies');
end;
/
并引发ora1031特权不足异常。该过程中只有执行立即操作
procedure create_object(p_sql in clob) is
begin
execute immediate p_sql;
dbms_output.put_line('create_object done');
exception
when others then
case
when (lower(p_sql) like ('create%')) and sqlcode = -955 or sqlcode = -2264 then
null;
when lower(p_sql) like ('alter% primary %') and sqlcode = -2260 or sqlcode = -2261 then
null;
when lower(p_sql) like ('alter% check %') and sqlcode = -2264 then
null;
when lower(p_sql) like ('alter% references %') and sqlcode = -2275 then
null;
else
raise;
end case;
end create_object;
当我不使用过程而只使用CREATETABLE或CREATETABLE INDECTION immediate语句时,它就工作了。我试图创建的create_对象过程和表也在一个模式中。为什么会发生这种情况?我猜
krn_ddl_mgr
的所有者已被授予通过角色创建表的权限
问题是通过角色授予的特权在PL/SQL中不活动。您需要直接将必要的特权授予包的所有者,而不是通过角色