Authid Current_User is
begin
Execute Immediate 'create table create_table(id int)';
end p_create_table;
--再尝试执行:
SQL> exec p_create_table;
PL/SQL procedure successfully completed
--已经可以执行了。
原来 是要使用调用者权限
因此在创建存储过程时需要加入Authid Current_User当前用户的权限
create or replace procedure createTS(tname in varchar2)
Authid Current_User
is
要在存储过程里动态创建创建表空间如下步骤。
1、需要采用Oracle自治事务。就在存储过程里加入PRAGMA AUTONOMOUS_TRANSACTION;子句
2、需要显示的分配置创建表空间的权限,否则提示权限不足。
grant alter tablespace to TEST;
grant create tablespace to TEST;
感谢网址楼主
http://www.dbfaq.net/FAQ/FixupQL.aspx QuestionID=112
http://bbs.csdn.net/topics/360053754