当前位置: 代码迷 >> Oracle开发 >> oracle 存储过程中使用execute immediate 创设 临时表
  详细解决方案

oracle 存储过程中使用execute immediate 创设 临时表

热度:606   发布时间:2016-04-24 06:28:47.0
oracle 存储过程中使用execute immediate 创建 临时表
create or replace procedure tet AUTHID CURRENT_USER
as
str varchar2(500);
begin
str := 'create global temporary table u as select * from test2';
execute immediate str;
end;

编译成功了,为什么我在 执行该存储过程中(exec tet;) 返回这样的错,请大家帮忙看看,非常感谢!
Error report -
ORA-00955: name is already used by an existing object
ORA-06512: at "SCOTT.TET", line 6
ORA-06512: at line 1
00955. 00000 -  "name is already used by an existing object"
------解决思路----------------------
数据库中已经存在此名称的数据库对象,重名了,数据库无法处理
这提示的很清楚了啊
------解决思路----------------------
临时表,最好是提示创建好,用的时候,直接 DML 操作就可以了,这样创建,如两个会话一起跑,肯定就会出你现在的问题,当然了,你第二次跑,也会出现。
------解决思路----------------------
出错了不要紧张,看错误提示,错误提示一般都一步到位
------解决思路----------------------
ORA-00955: name is already used by an existing object
00955. 00000 -  "name is already used by an existing object" 
重名了
  相关解决方案