场景如下:
-- Created on 2011-2-12 by ADMINISTRATOR
declare
TableName_ varchar2(32) := 'sp_warehousecheckserial';
sqlstr_ varchar2(1000);
begin
sqlstr_ := 'create table temp_'|| TableName_ || '
as
select c.sguid,
c.slogconfigid,
c.scolumnname
from sys_logconfig f ,
sys_logconfigdetail c
where f.sguid = c.slogconfigid
and f.stablename = ''' || TableName_ || '''';
execute immediate sqlstr_;
end;
上面这样子执行是成功的。
-------------------------------------------------------
封装成存储过程来执行就出问题:
create or replace procedure pd_CreateValueTable(
TableName_ in varchar2
) is
sqlstr_ varchar2(1000);
begin
sqlstr_ := 'create table temp_'|| TableName_ || '
as
select c.sguid,
c.slogconfigid,
c.scolumnname
from sys_logconfig f ,
sys_logconfigdetail c
where f.sguid = c.slogconfigid
and f.stablename = ''' || TableName_ || '''';
/*sqlstr_ :='create table temp_'|| TableName_ || '( aa varchar2(32))';*/
execute immediate sqlstr_;
end pd_CreateValueTable;
------------
declare
-- Local variables here
i integer;
begin
-- Test statements here
steel.pd_createvaluetable('sp_warehousecheckserial');
end;
------------------------
提示权限不够。
当时的用户还具有了DBA的权限,可为什么还是不行,百思不得其解。
最后,解决办法如下:
grant create any table to 用户名;
问题解决了。
阅读(2013) | 评论(1) | 转发(0) |